Using Ruby A dentist appointment schedule validation software Implement a superclass Appointment and sub classes OneTime, Day and...

60.1K

Verified Solution

Question

Programming

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.

Answer & Explanation Solved by verified expert
3.7 Ratings (331 Votes)
1 ANSWER GIVENTHAT inquiryrb usrbinenv ruby requirerelative appointment def generateAppointmentclazz app AppointmentgetInstanceclazz r Randomnew appday rrand110000000 30 1 appmonth rrand110000000 12 1 appyear rrand20142017 appdescription appclass appointment on appmonthappdayappyear app end def generateArraysize apps get a rand for class type r RandomnewTimenowtof 100000round for i in 0size 0 for OneTime 1 for Day 2    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students