data structure

computer science

Description

The data structure may have the following services encapsulated in an interface: interface IAppointmentSchedule{ void addTime(int hour, int minute); void removeTime(int hour, int minute); void addAppointment(String name, int hour, intminute); //you may or may not need more methods…. } For easy management of appointments, it’s probably convenient to have an appointment class like: Class Appointment { String day; //like Monday, Thuesday, …. String patient; int hour, minute; //methods you need } With this Appointment class, a data structure class that implements the above interface might look like: class AppointmentSchedule implements IAppointmentSchedule{ private List schedules; //…. } However, this is just one of the ways how data are organized. For instance, you can also write an Appointment class without String instance variable "day", and use a hash map like: Map schedules = new HashMap(); The "key" of the map can be a weekday like "Tuesday" or "Thursday", but "key" can also be a date like 1/30/2016". 



 To control the program flow of actions, a controller may also be needed, which is much like the one we had in that example of AddressBookApp. interface AppointmentOps{ Void initialize(); Void runMainFlow(); Void addData(); //you would need to add data manually if you do not use a data text file. //…. } Do you need elements like "Doctor" or "Patient"? Think about that use case (in the assignment sheet), when you run the program, you play a role as doctor or patient. "Who is the doctor?" is irrelevant, and for making an appointment, only patient names are needed (as shown in the use case). So, such elements would not play roles in software operation. Again, the example can also be helpful here.... We have not talked about yet how we may express a design using diagrams or other means, so for this first assignment, you are not required to do any diagramming. All you need to do is to use the example to come up with a program structure in your mind, and implement it in code.


Related Questions in computer science category


Disclaimer
The ready solutions purchased from Library are already used solutions. Please do not submit them directly as it may lead to plagiarism. Once paid, the solution file download link will be sent to your provided email. Please either use them for learning purpose or re-write them in your own language. In case if you haven't get the email, do let us know via chat support.