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

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

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