SHARE
TWEET

Untitled

a guest Apr 21st, 2019 90 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Isaiah Ramnath Final Project
  2. #include <iostream>
  3. #include  <windows.h>
  4. #include  <fstream>
  5. #include  <string>
  6.  
  7. using  namespace std;
  8.  
  9. const int Jello = 20;
  10.  
  11. //Class Definition
  12. class AppointmentList
  13. {
  14.  
  15. private:
  16.  
  17.     //Struct Array
  18.     struct AppointmentData
  19.     {
  20.         string name;
  21.         string idnum;
  22.         string cellnum;
  23.         string time;
  24.  
  25.     }App[Jello];
  26.  
  27.  
  28.  
  29. public:
  30.  
  31.     //constructor
  32.  
  33.     AppointmentList();
  34.  
  35.     //accessor
  36.  
  37.     void viewData()const;
  38.     void helpGuide()const;
  39.  
  40.     //mutator
  41.    
  42.     void SetData(string, string, string, string);
  43.     void searchApp(string);
  44.  
  45.  
  46.  
  47. //Public End
  48.  
  49. };
  50.  
  51.  
  52. int main()
  53. {
  54. //Object
  55.     AppointmentList Appointments;
  56.     string student, id, phone, date;
  57.     ofstream WriteAppointment;
  58.     ifstream readFile;
  59.     char choice = ' ';
  60.  
  61.     do
  62.     {
  63.         cout << "\n  Appointment Register";
  64.         cout << "\n-------------------------";
  65.         cout << "\n 1. Add an appointment"
  66.              << "\n 2. Update an appointment"
  67.              << "\n 3. Display appointments"
  68.              << "\n 4. Search for appointment through an ID Number"
  69.              << "\n 5. Delete an appointment"
  70.              << "\n 6. Help Guide"
  71.              << "\n 7. Exit program"
  72.              << "\n Enter Your Choice: ";
  73.  
  74.         cin >> choice;
  75.  
  76.         switch (choice)
  77.         {
  78.  
  79.         //ADD APPOINTMENT
  80.         case '1':
  81.  
  82.  
  83.             for(int i = 0; i < Jello ; i++)
  84.             {
  85.  
  86.  
  87.               WriteAppointment.open("appointmentlist.txt",ios::out|ios::app);
  88.  
  89.                 cout << "\n Enter student's name: ";
  90.                 cin.get();
  91.                 getline(cin, student);
  92.  
  93.                 cout << "\n Enter ID number: ";
  94.                 getline(cin, id);
  95.  
  96.                 cout << "\n Enter phone contact: ";
  97.                 getline(cin, phone);
  98.  
  99.                 cout << "\n Enter time of appointment: ";
  100.                 getline(cin, date);
  101.  
  102.                 Appointments.SetData(student, id, phone, date);
  103.  
  104.                 WriteAppointment << student << id << phone << date;
  105.  
  106.                 break;
  107.             }
  108.             break;
  109.  
  110.             //DISPLAY APPOINTMENTS
  111.             case '3':
  112.  
  113.                 Appointments.viewData();
  114.  
  115.                 break;
  116.  
  117.             //HELP GUIDE
  118.             case '6':
  119.  
  120.                 Appointments.helpGuide();
  121.  
  122.  
  123.                      break;
  124.  
  125.             //EXIT PROGRAM
  126.             case '7':
  127.                 cout << "\n Exiting Program, Goodbye! ";
  128.  
  129.                 break;
  130.         }
  131.     }
  132.   while(choice!= '7');
  133.  
  134.   WriteAppointment.close();
  135. }
  136.  
  137. //constructor
  138. AppointmentList::AppointmentList()
  139.  
  140. {
  141.     for(int i = 0; i < Jello; i++)
  142.     {
  143.  
  144.         App[i].name = " ";
  145.         App[i].idnum = " ";
  146.         App[i].cellnum = " ";
  147.         App[i].time = " ";
  148.     }
  149. }
  150.  
  151.  
  152. //View Data
  153. void AppointmentList::viewData()const
  154. {
  155.  
  156.     for (int i = 0; i < Jello; i++)
  157.     {
  158.         if(App[i].name!= " ")
  159.  
  160.  
  161.         {
  162.             cout << "\n Student Name:  " << App[i].name
  163.                  << "\n Student ID: " << App[i].idnum
  164.                  << "\n Student PhoneContact: " << App[i].cellnum
  165.                  << "\n Student AppointmentTime#: " << App[i].time << endl << endl;
  166.         }
  167.  
  168.  
  169.  
  170.     }
  171.  
  172. }
  173.  
  174. //Help Guide
  175. void AppointmentList::helpGuide()const
  176. {
  177.  
  178.      cout << "\n ----------------------------------------------------------------------------------------------------"
  179.           << "\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."
  180.           << "\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."
  181.           << "\n Selection of no.3 in the appointment register will allow the user to display all Appointments stored."
  182.           << "\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."
  183.           << "\n Selection of no.5 in the appointment register will allow the user to delete any appointment chosen."
  184.           << "\n Thank you, Enjoy!"
  185.           << "\n ----------------------------------------------------------------------------------------------------";
  186.  
  187. }
  188.  
  189.  
  190. //mutator
  191. void AppointmentList::SetData(string student, string id, string phone, string date)
  192. {
  193.     for (int i = 0; i < Jello; i++)
  194.     {
  195.         if(App[i].name == " ")
  196.         {
  197.             App[i].name = student;
  198.             App[i].idnum = id;
  199.             App[i].cellnum = phone;
  200.             App[i].time = date;
  201.             break;
  202.         }
  203.  
  204.     }
  205.  
  206. }
  207.  
  208. //Searching For Appointment
  209. void AppointmentList::searchApp(string id)
  210. {
  211.     for (int i = 0; i = Jello; i++)
  212.     {
  213.         if(App[i].idnum == " ")
  214.         {
  215.            
  216.         }
  217.     }
  218. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top