Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA (This program should be supported on command line) Write a program in which you implement all three classes above and demonstrate every behavior of
JAVA (This program should be supported on command line)
Write a program in which you implement all three classes above and demonstrate every behavior of each. Make sure that the user has ample opportunity to input names and dates.
If you follow the UML, my test program should work with your class files.
Screen Shot 2019-03-05 at 10.15.09 AM a Screen Shot 2019-03-05 at 10.15.31 AM a Search Search CLASS CONSTRUCTION AND INHERITANCE We'll start with a parent class... Person dayOfMonth: int 31 monthofYcar int.12 year: ine.g. 2013 gs: GregorianCalenda dateFomat: boolean dateStyle: boolcan // true for months as numbers, false as months as names static final boolcan OCCCDATE US (true)for the convenience of our clients + static final boolean OCCCDATE EURO (false) I/ another one + static final boolean OCCCDATE STYLE NUMBERS (true) a private helper object true for US date format, false for Euro format; default is true tirstName: String lastName: String +Person (String firstName. String lastName + Person (String firstName. String lastNams. QCCCDate dob + Person (Person p) copy constructor static final boolean OCCCDATE STYLE NAMES (false) + OCCCDate0 default constructor, uses current date and time + OCCCDat(int day, int month, int year) + OCCCDatc(GregorianCalendar zc) +OCCCDatc(QCCCDats d)I/copy constructor +int gstDayofMonth0 +String getDayQWeek // Sunday, Monday, Tuesday + int gstMonth0January, 2-February. + String getNamcOfMonth0 / January, February, March + int getYsar Gregorian year, eg. 2016 + void setDateFormat(boolcan d0 + void setStyleFormat(boolcan sf) + int getDifferencelnYears0; I/ difference in years between this OCCCDate and now + int getDitferenceInYears(OCCCDate d); difference in years between this date and d + boolean equals(OCCCDats dob) l compare only day, month, and year String toSring0 // US format mm/dd/yyyyor monthName dd. yxyy String getkirstNamc +String gstlastNamcl0 + void sctFirstName(String fn + void setlastName(String In) + int getAg0; returns age in years, not rounded + String toString0 // format lastNams, firsiNamc (birthdate) II Gordon, Freeman (05/19/1955) + boolean equals(Person) I/ ignore case on the first and last names + void eat0 / simply prints "Person is eating..." on the console + void sleep0 ..as above + void playO ...as above + void run as above On the eat sleep / play run methods make sure you obtain the identity of the class using a method; that way when the children invoke it their class types will be displayed. Euro format dd/mm/vvvy or dd monthName yvyy We'll add to this a derived class ...and a calendar class that is really a wrapper around the built-in GregorianCalendar class. RegisteredPers Strin RegisteredPerson (String firstName, String lastNams, oCCCDate dob, String goxlD) RegieredPerson (Person p, String govlD) RegistersdPerson (RegisteredPsrsonp) + String getGoxcamsntlDO +boolean equals(RcgisteredPerson m)/ the usual equals method + boolcan equals(Person p) I/ compare only Person fields, ignore government IDStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started