Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need to 1. Add code to AgeCalculator.java to get current date and then use the

ID: 3656963 • Letter: I

Question

I need to 1. Add code to AgeCalculator.java to get current date and then use the current year to validate the birth year the user enters. 2. Add code to create, format and print user

Explanation / Answer

import java.util.Calendar; public class Person { private String firstname; //must be greater than 0 and not null private String lastname; //must be greater than 0 and not null private int yearOfBirth; //must be between 1900 and 2100 validate private int monthOfBirth; //must be between 1 and 12 validate private int dayOfBirth; //must be between 1 and 31 (dont worry about the other deatils) public String getFirstName(String firstname){ return firstname; } public void setFirstName(String firstNameChange){ if (firstname != null && firstname.length() > 0){ firstNameChange = firstname; } else{ System.out.println("Error! Must Enter at least one letter for the first name!"); System.exit(0); } } public String getLastName(){ return lastname; } public void setLastName(String lastNameChange){ if (lastname != null && lastname.length() > 0){ lastNameChange = lastname; } else{ System.out.println("Error! Must Enter at least one letter for the last name!"); System.exit(0); } } public String getBirthDate(){ //format must be day/month year using instance variables } public int getAge(int age){ Calendar now=Calendar.getInstance(); int thisyear = now.get(Calendar.YEAR); int thismonth = now.get(Calendar.MONTH); int thisday = now.get(Calendar.DAY_OF_MONTH); //compute age based upon values for "today" //need to use subtraction for the year and if() to determine if birthday has passed } public Person(String firstName, String lastName, int birthYear, int birthMonth, int birthDay){ //a contrsuctor that takes these parameters } private Person(){ //a contrsuctor that takes no arguments } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote