Code:
// user input methods, by datatype
//---------------------------------------------------------------------------
// get an int value
public static int readInt(String prompt, boolean guiMode) {
// TODO: add a second boolean input argument for a "guiMode",
// then wrap an if-else around the existing Scanner input below
// if F, get input as shown from Scanner (command line)
// if T, get input from JOptionPane (popup GUI) - YOU PROVIDE THIS CODE
// set up data and objects
Scanner input = new Scanner(System.in);
int data = 0;
if (!guiMode)
{
// prompt for an input int value
System.out.print(prompt);
data = input.nextInt();
}
else if (guiMode)
{
// prompt for an input int value
data = Integer.parseInt(JOptionPane.showInputDialog(null, prompt));
}
return data;
}
this code about is completed and good.
Code:
// returns the age as of some REFERENCE date (2-input overloaded form, MODS NEEDED)
public static int getAge(CS12Date dateBd, CS12Date dateRef) {
int age = -1; // starter output
// TODO: calculate the age correctly, given birthdate AND a reference date
// 1) take apart both input dates into MM, DD, YYYY using accessors --> 6 ints
// 2) devise needed logic to calculate age for dateBd "as of" dateRef
// a) if dateBd is *after* dateRef in time (future BD), return -1 *and* print an error message
// b) do NOT print age from here, just return its value to the client
return age;
} // end 2-input overloaded version
This is what I have to do modify this method to get age.
this is the client of the program below
Code:
ublic static void main (String args[])
{
int month;
int day;
int year;
month = UtilsES.readInt("enter Birthday month:", false);
day = UtilsES.readInt("Enter Birthday Day", false);
year = UtilsES.readInt("Enter Birthday Year", false);
}
My goal is to compare two dates for one date in the future. Uhh this is been a weird assignement can anyone give me some clues?
https://pastebin.com/qMz9A4Ti - age client
https://pastebin.com/rdjGqaX7 - cs12Date
https://pastebin.com/hfWYwQHU - UtilsTest1ES
link to all the codes
My skype is InspiredProgramming
https://www.scribd.com/document/3444...-Age-Utilities
pdf of assignment