GetAge.java/Java Application – Get Age
Create a java application to prompt the user for the year, month, and day of birth, and display their age in years. Here is an example of a typical program run:
The main method and method stubs have already been written for you. Upload the file GetAge.java from Moodle and use it to complete the assignment.
Do not make any changes to this code other than to add your name to the comments at the top of the file to indicate that you have completed the code; and to complete the code in the method stubs.
Complete the code in the method stubs as follows:
public static int getYear(Scanner kb, int endYear)
The getYear method should use the Scanner parameter passed to prompt the client for their year of birth. The year must be between zero and the endYear parameter. Perform this processing in a loop until the year is valid. Return the year of birth,
public static int getMonth(Scanner kb)
The getMonth method should use the Scanner parameter passed to prompt the client for their month of birth. The month must be between 1 and 12. Perform this processing in a loop until the month is valid. Return the month of birth,
public static int getDay(Scanner kb, int dobYear, int dobMonth)
The getDay method should use the Scanner parameter passed to prompt the client for their day of birth. The day must be between 1 and a maximum day determined by the month. For example, the maximum day for January is 31, but for April it is 30. The maximum day for February is 28 unless it is a leap year, in which case the maximum day is 29. Perform this processing in a loop until the day is valid. Return the day of birth.
public static String getMonthName(int month)
The getMonthName method should return the name of the month that is passed as an argument to the method.
public static String getDaySuffix(int day)
The getDaySuffix method should return the suffix for the day of the month. For example, the suffix for 1, 21, and 31 is “st”; for 2 and 22 is “nd”; for 3 and 23 is “rd”; and for the remaining days is “th”.
public static int getAge(int dobYear, int dobMonth, int dobDay)
The getAge method should calculate and return the age based on the year, month, and day of birth. The current date should be used to determine the age.
public static void displayAge(int dobYear, int dobMonth, int dobDay)
This method should call the getMonthName to get the name of the month. It should call the getAge method to get the user’s age. It should then display the formatted date of birth and the user’s age. If the user is 21 years of age or more, display that they are eligible to drink, otherwise display that they are not eligible to drink alcohol. See the run example on the previous page for an example of how to display this information.
• Provide dummy return values for the method stubs so that the program will compile.
• Code only one method at a time and test that method until it works properly.
• Provide appropriate comments for each method
• Correct File Name (GetAge.java) – case sensitive
• Correct Class Name (GetAge) – case sensitive
• Correct Style – comments for each method
• Correct Style – indentation
• Correct Style – White Space
• Free of syntax errors
• No changes made to the main method in the original code provided
• getYear method prompt and validate correctly in loop
• getMonth method prompt and validate correctly in loop
• getDay method determine maximum day correctly
• getDay method prompt and validate correctly in loop
• getMonthName method returns correct month name
• getAge method calculates and returns correct age
• displayAge method calls the getMonthName method
• displayAge method calls the getAge method
• displayAge method displays formatted date
• displayAge method displays age
PLACE THIS ORDER OR A SIMILAR ORDER WITH US TODAY AND GET AN AMAZING DISCOUNT ?
Our Service Charter
Excellent Quality / 100% Plagiarism-FreeWe employ a number of measures to ensure top quality essays. The papers go through a system of quality control prior to delivery. We run plagiarism checks on each paper to ensure that they will be 100% plagiarism-free. So, only clean copies hit customers’ emails. We also never resell the papers completed by our writers. So, once it is checked using a plagiarism checker, the paper will be unique. Speaking of the academic writing standards, we will stick to the assignment brief given by the customer and assign the perfect writer. By saying “the perfect writer” we mean the one having an academic degree in the customer’s study field and positive feedback from other customers.
Free RevisionsWe keep the quality bar of all papers high. But in case you need some extra brilliance to the paper, here’s what to do. First of all, you can choose a top writer. It means that we will assign an expert with a degree in your subject. And secondly, you can rely on our editing services. Our editors will revise your papers, checking whether or not they comply with high standards of academic writing. In addition, editing entails adjusting content if it’s off the topic, adding more sources, refining the language style, and making sure the referencing style is followed.
Confidentiality / 100% No DisclosureWe make sure that clients’ personal data remains confidential and is not exploited for any purposes beyond those related to our services. We only ask you to provide us with the information that is required to produce the paper according to your writing needs. Please note that the payment info is protected as well. Feel free to refer to the support team for more information about our payment methods. The fact that you used our service is kept secret due to the advanced security standards. So, you can be sure that no one will find out that you got a paper from our writing service.
Money Back GuaranteeIf the writer doesn’t address all the questions on your assignment brief or the delivered paper appears to be off the topic, you can ask for a refund. Or, if it is applicable, you can opt in for free revision within 14-30 days, depending on your paper’s length. The revision or refund request should be sent within 14 days after delivery. The customer gets 100% money-back in case they haven't downloaded the paper. All approved refunds will be returned to the customer’s credit card or Bonus Balance in a form of store credit. Take a note that we will send an extra compensation if the customers goes with a store credit.
24/7 Customer SupportWe have a support team working 24/7 ready to give your issue concerning the order their immediate attention. If you have any questions about the ordering process, communication with the writer, payment options, feel free to join live chat. Be sure to get a fast response. They can also give you the exact price quote, taking into account the timing, desired academic level of the paper, and the number of pages.