Using Ruby
A dentist appointment schedule validation software
Implement a superclass Appointment and sub classes OneTime, Dayand Month. An appointment has a description (for example, \"RootCanal\"), and dates information (you can use Date object or intYear, Int Month, Int Day). Fill an array of Appointment objectswith a mixture of appointments.
Write a method OccursOn inside each of the sub classes thatchecks whether the appointment occurs on that date (OneTime), day(Day) or month (Month). Ask the user to enter a date to check (forexample, 2006 10 5), and ask to user if they want to check againstOneTime, Day or Month appointment. Based on what the user selected,OccursOn inside each of the sub class should run and display anymatching appointment and associated descriptions.
Hint: For OneTime subclass, OccursOn need three inputs (Year,Month and Day) to validate, for Day subclass, OccursOn needs oneinput (Day) to validate, and for Month subclass, OccursOn need oneinput (Month) to validate. OccursOn is different for differentsubclasses.