Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Define three classes as shown in the class diagram below. The class Age encapsulates an age. An age has two attributes: a current date (D1)
Define three classes as shown in the class diagram below. The class Age encapsulates an age. An age has two attributes: a current date (D1) and a date of birth (D2). A date record is defined by the values of day, month and year: (d.m.y). Define the method getAge( in the class age which returns the age of the entered dates given by the following formula for an age Age- (d2-d1) + (M2-M1)*30+ (y2-y1)*365 Where d2 m2.y2 presents the current date and d1,m1,y1 presents the date of birth In the main method of the Test class, create age (10-01-2000 and current date is (29-09-2020) and print the age. Test Age Dates -maino D1: Dates Integer D2: Dates mi integer y: integer - AgeCurrentdate Dates, Dateofbirth Dates d integer, minteger, y Dates) integer getAge: Integer Setid:integer SetMim:integer Setely: integer Meeting in \"General\" 1 *getsinteger IA getManteger -getsinteger ES
Step 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