I need this in pseudocode. If anyone can answer a. Create a class named Year tha
ID: 3566852 • Letter: I
Question
I need this in pseudocode. If anyone can answer
a. Create a class named Year that contains data fields to hold the number of months in a year and the number of days in a year. Include a constructor that sets the number of months to 12 and the number of days to 365, and get and set methods for each field.
b. Create a subclass named LeapYear. LeapYear's constructor overrides Year's constructor and sets the number of days to 366.
c. Design an application that instantiates one object of each class and displays all the data.
Explanation / Answer
class ApplicationMainClass
main()
Year myYear = new Year()
LeapYear myLeapYear = new LeapYear()
printAsLine myYear.getNumberOfMonths()
printAsLine myYear.getNumberOfDays()
printAsLine myLeapYear.getNumberOfMonths()
printAsLine myLeapYear.getNumberOfDays()
class Year
NumberOfMonths
NumberOfDays
Constructor()
NumberOfMonths = 12
NumberOfDays = 365
getNumberOfMonths()
return NumberOfMonths
getNumberOfDays()
return NumberOfDays
class LeapYear extends Year
Constructor()
NumberOfMonths = 12
NumberOfDays = 366
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.