Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Isaiah Ramnath Final Project
- #include <iostream>
- #include <windows.h>
- #include <fstream>
- #include <string>
- using namespace std;
- const int Jello = 20;
- //Class Definition
- class AppointmentList
- {
- private:
- //Struct Array
- struct AppointmentData
- {
- string name;
- string idnum;
- string cellnum;
- string time;
- }App[Jello];
- public:
- //constructor
- AppointmentList();
- //accessor
- void viewData()const;
- void helpGuide()const;
- //mutator
- void SetData(string, string, string, string);
- void searchApp(string);
- //Public End
- };
- int main()
- {
- //Object
- AppointmentList Appointments;
- string student, id, phone, date;
- ofstream WriteAppointment;
- ifstream readFile;
- char choice = ' ';
- do
- {
- cout << "\n Appointment Register";
- cout << "\n-------------------------";
- cout << "\n 1. Add an appointment"
- << "\n 2. Update an appointment"
- << "\n 3. Display appointments"
- << "\n 4. Search for appointment through an ID Number"
- << "\n 5. Delete an appointment"
- << "\n 6. Help Guide"
- << "\n 7. Exit program"
- << "\n Enter Your Choice: ";
- cin >> choice;
- switch (choice)
- {
- //ADD APPOINTMENT
- case '1':
- for(int i = 0; i < Jello ; i++)
- {
- WriteAppointment.open("appointmentlist.txt",ios::out|ios::app);
- cout << "\n Enter student's name: ";
- cin.get();
- getline(cin, student);
- cout << "\n Enter ID number: ";
- getline(cin, id);
- cout << "\n Enter phone contact: ";
- getline(cin, phone);
- cout << "\n Enter time of appointment: ";
- getline(cin, date);
- Appointments.SetData(student, id, phone, date);
- WriteAppointment << student << id << phone << date;
- break;
- }
- break;
- //DISPLAY APPOINTMENTS
- case '3':
- Appointments.viewData();
- break;
- //HELP GUIDE
- case '6':
- Appointments.helpGuide();
- break;
- //EXIT PROGRAM
- case '7':
- cout << "\n Exiting Program, Goodbye! ";
- break;
- }
- }
- while(choice!= '7');
- WriteAppointment.close();
- }
- //constructor
- AppointmentList::AppointmentList()
- {
- for(int i = 0; i < Jello; i++)
- {
- App[i].name = " ";
- App[i].idnum = " ";
- App[i].cellnum = " ";
- App[i].time = " ";
- }
- }
- //View Data
- void AppointmentList::viewData()const
- {
- for (int i = 0; i < Jello; i++)
- {
- if(App[i].name!= " ")
- {
- cout << "\n Student Name: " << App[i].name
- << "\n Student ID: " << App[i].idnum
- << "\n Student PhoneContact: " << App[i].cellnum
- << "\n Student AppointmentTime#: " << App[i].time << endl << endl;
- }
- }
- }
- //Help Guide
- void AppointmentList::helpGuide()const
- {
- cout << "\n ----------------------------------------------------------------------------------------------------"
- << "\n Selection of no.1 in the appointment register will allow the user to create an Appointment for a student by generating the Student's Name, ID Number, Contact Number and Appointment Date/Time."
- << "\n Selection of no.2 in the appointment register will allow the user to edit/update an Appointment for a Student's Name, ID Number, Contact Number and Appointment Date/Time."
- << "\n Selection of no.3 in the appointment register will allow the user to display all Appointments stored."
- << "\n Selection of no.4 in the appointment register will allow the user to search for a specific Appointment by entering the Student's ID Number."
- << "\n Selection of no.5 in the appointment register will allow the user to delete any appointment chosen."
- << "\n Thank you, Enjoy!"
- << "\n ----------------------------------------------------------------------------------------------------";
- }
- //mutator
- void AppointmentList::SetData(string student, string id, string phone, string date)
- {
- for (int i = 0; i < Jello; i++)
- {
- if(App[i].name == " ")
- {
- App[i].name = student;
- App[i].idnum = id;
- App[i].cellnum = phone;
- App[i].time = date;
- break;
- }
- }
- }
- //Searching For Appointment
- void AppointmentList::searchApp(string id)
- {
- for (int i = 0; i = Jello; i++)
- {
- if(App[i].idnum == " ")
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement