Question: Write java code that inputs a person's birth date (month, day, year) and today's date (month, day, year). Then call a method CalculateAge() to determine
- Write java code that inputs a person's birth date (month, day, year) and today's date (month, day, year). Then call a method CalculateAge() to determine how many years old the person is.
- Convert dates (today's date and the birthdate) to YYYYMMDD format (year * 10000 + month * 100 + day).
- Subtract the birth date from today's date.
- Divide the result by 10000 to get the number of years.
- Return the number of years.
- Display results in main()
- Don't use Array, stick to simple code.
Step by Step Solution
There are 3 Steps involved in it
java import javautilScanner public class AgeCalculator public static void mainString args Scanner scanner new ScannerSystemin SystemoutprintEnter birth date YYYY MM DD int birthDate IntegerparseIntsca... View full answer
Get step-by-step solutions from verified subject matter experts
