Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Code based question: Implement a superclass Appointment and sub classes One Time, Day and Month. An Appointment has a description (for example, ''Pull Teeth) and
Code based question: Implement a superclass Appointment and sub classes One Time, Day and Month. An Appointment has a description (for example, ''Pull Teeth") and a date. Write a method Occurs on (int year, int month, int day) that checks whether the appointment occurs on that date. For example, for checking on month, you must check whether the month matches from a pool of existing appointments. You will also need to prefill an array of appointments with the Appointment objects and your code is simply checking against them. Have the user enter a date to check, and you should display them once the appointment matched. There should be appointments already created and you are simply asking the users for a date to check against them. There are several ways that you can approach this question. The example below is just one way of solving this problem. Write a method occurs on inside each of the sub classes that checks whether the appointment occurs on that date (One Time), day (Day) or month (Month). Ask the user to enter a date to check (for example, 2006 10 5), and ask to user if they want to check against One Time, Day or Month appointment. Based on what the user selected, occurs on inside each of the sub class should run and display any matching appointment and associated descriptions. For Onetime subclass, occurs on need three inputs (Year, Month and Day) to validate, for Day subclass, occurs on needs one input (Day) to validate, and for Month subclass, occurs on need one input (Month) to validate. occurs on is different for different subclasses
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