1. Define a class Appointment that has three instance variables: Id (int), slotld (int) and isAvailable (a boolean type; true if the appointment slot is available to book; false otherwise). Include appropriate constructors. Add display() method that returns a string containing appointment's information. Define another class Student that has three instance variables: studentld, Name and appointment information which is made by a student. Include appropriate constructors. Add display() method that returns a string containing student's information. Add an addAppointment (Appointment a) method which is invoked when a student wants to make an appointment. Inside this method there will be a condition that checks the availability of the appointment slot because there are only 10 slots for the appointment. Please note that, when an appointment is made, isAvailable field would be set to true. Write a Main class that includes a main () method for testing the functionalities of these two classes: Appointment and Student. Create an ArrayList of Student class for 11 students and invoke addAppointment(a) and display() methods of the Student and Appointment class appropriately. Remember that, for 1I student print a message "Slots are not available" because there are ten appointment slots.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter11: Introduction To Classes
Section11.2: Basic Class Functions
Problem 12E
icon
Related questions
Question

Code in java... 

1. Define a class Appointment that has three instance variables: Id (int), slotld (int)
and isAvailable (a boolean type; true if the appointment slot is available to book;
false otherwise). Include appropriate constructors. Add display() method that
returns a string containing appointment's information.
Define another class Student that has three instance variables: studentld, Name
and appointment information which is made by a student. Include appropriate
constructors. Add display() method that returns a string containing student's
information. Add an addAppointment (Appointment a) method which is invoked
when a student wants to make an appointment. Inside this method there will be a
condition that checks the availability of the appointment slot because there are
only 10 slots for the appointment. Please note that, when an appointment is made,
isAvailable field would be set to true.
Write a Main class that includes a main () method for testing the functionalities
of these two classes: Appointment and Student. Create an ArrayList of Student
class for 11 students and invoke addAppointment(a) and display) methods of the
Student and Appointment class appropriately. Remember that, for 11 student
print a message "Slots are not available" because there are ten appointment slots.
Transcribed Image Text:1. Define a class Appointment that has three instance variables: Id (int), slotld (int) and isAvailable (a boolean type; true if the appointment slot is available to book; false otherwise). Include appropriate constructors. Add display() method that returns a string containing appointment's information. Define another class Student that has three instance variables: studentld, Name and appointment information which is made by a student. Include appropriate constructors. Add display() method that returns a string containing student's information. Add an addAppointment (Appointment a) method which is invoked when a student wants to make an appointment. Inside this method there will be a condition that checks the availability of the appointment slot because there are only 10 slots for the appointment. Please note that, when an appointment is made, isAvailable field would be set to true. Write a Main class that includes a main () method for testing the functionalities of these two classes: Appointment and Student. Create an ArrayList of Student class for 11 students and invoke addAppointment(a) and display) methods of the Student and Appointment class appropriately. Remember that, for 11 student print a message "Slots are not available" because there are ten appointment slots.
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Unreferenced Objects
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr