pexels-kulbir-11079217
pexels-kulbir-11079217
pexels-kulbir-11079217
The task is to take input from a user a date (say the date of birth). The input
Home » Java  »  The task is to take input from a user a date (say the date of birth). The input
The task is to take input from a user a date (say the date of birth). The input
The task is to take input from a user a date (say the date of birth). The input is taken in three values: Year, Month, and Day. Your task is: - To check every possible input error and upon detection, prompts the user to enter the value again. - All three inputs are numbers (integer type). Then calculate the current age based on the provided input and show the age on the screen. Possible type of error/exception(s) are listed below (but not limited to): - The year cannot be more than 110 years from the current year. Also, check the validity of the year value (like no negative number, no character, etc.). - Need to check the validity of month and day values (There could be various possible scenarios). (for example, February can not be more than 28 if not leap year; day can not be more than 31 for certain months, etc.) - Need to check whether the user types the values in the right format (the valid user input should contain digits, not any other characters). -Check null or empty values. You are required to write one function that checks the validity of the input and another function to calculate the current age ( years, months and days) and print the value on the screen. Use the try-catch-finally block structure to handle all errors and/or exceptions in your program.

Leave a Reply

Your email address will not be published.

Scan the code