Advertisement
HarisZamil

DAE20103G4

Jul 5th, 2020
1,531
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 9.00 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdlib.h> //functions involving memory allocation, process control, conversions
  3. #include <string>
  4. #include <sstream> // Strings are used for storing a text
  5. #include <fstream> // it can create files, write information to files, and read information from files
  6. #include <ctime>
  7. #include <sys/types.h>
  8. #include <sys/stat.h>
  9. #include <cerrno>
  10. using namespace std;
  11.  
  12.  
  13. string option, name, id_no, phone_no;
  14.  
  15. void print_bill(float bill)
  16. {
  17.     string p_option;
  18.     cout << "\n            Welcome to Billing Deparment    \n\n" << endl;
  19.     cout << "         ---------------Receipt---------------\n\n" << endl;
  20.     cout << "        ***************************************" << endl;
  21.     cout << "         Name:" << name;
  22.     cout << "       \tId card number:" << id_no << endl;
  23.     cout << "         Phone no:" << phone_no << endl;
  24.     cout << "        ***************************************\n" << endl;
  25.     cout << "        ***************************************" << endl;
  26.     cout << "         Service charge\t\t\t"<< bill << endl;
  27.     cout << "              TAX      \t\t\t"<< bill*10/100 << endl;
  28.     cout << "        ***************************************" << endl;
  29.     cout << "         Total Bill    \t\t\t" << bill + (bill * 10 / 100) << endl;
  30.     cout << "        ***************************************" << endl;
  31.  
  32.     system("pause");
  33.     system("cls");
  34.     cout << "              Pay Bill       \n\n" << endl;
  35.     cout << " Do you want to pay with cash or card ? "<< endl;
  36.     cout << "           [1] - Card                   " << endl;
  37.     cout << "           [2] - Cash                   " << endl;
  38.     cout << "           [3] - e-wallet               " << endl;
  39.     cout << "\n           Select your payment types  ";
  40.     cin>>p_option;
  41.     if (p_option == "1")
  42.     {
  43.         string card_no = "";
  44.         do {
  45.             cout << "\n   Please Insert your Card Numbers   ";
  46.             cin >> card_no;
  47.         }while (card_no.length()!=16); //bool isvalid = check_valid(card_no);
  48.         cout << "\n      Thank You, we have received your payment.  ";
  49.     }
  50.     if (p_option == "2")
  51.     {
  52.         cout << "\n       Please Submit Your Cash       \n";
  53.         cout << "\n      Thank you for your payment     ";
  54.  
  55.     }
  56.     if (p_option == "3")
  57.     {
  58.         cout << "\n      We have connected with your E-Wallet Apps      \n";
  59.         string wallet_name;
  60.  
  61.         getline(cin, wallet_name);
  62.         cout << "\n      Thank You, your transaction is successful.     ";
  63.     }
  64.  
  65. }
  66.  
  67. int main() {
  68.  
  69.     /* Display the title of the program */
  70.  
  71.     system("color 0");
  72.     //system("pause");
  73.     system("cls");
  74.  
  75.     int bill[10];
  76.     float  total_bill=0.0F;
  77.  
  78.  
  79.     system("color 0");
  80.  
  81.     cout << endl;
  82.     cout << "                 Welcome to The Hospital     \n\n\n\n" << endl;
  83.     cout << "          Please Fill The Information Details  \n";    //save a string
  84.  
  85.     cout << "\t\tName: " ;
  86.     getline(cin, name);
  87.     cout << endl;
  88. again:
  89.     cout << "\t\tIC Numbers: ";
  90.     getline(cin, id_no);
  91.     cout << endl;
  92.     cout << "\t\tPhone Numbers: ";
  93.     getline(cin, phone_no);
  94.  
  95.     if (id_no.length() != 12 || phone_no.length() != 10)
  96.     {
  97.         cout << "Make Sure You Enter The Correct Number!" << endl;
  98.         cout << "Please Enter Again: " << endl;
  99.         goto again;
  100.     }
  101.     system("cls");
  102.     /* Display the MENU */
  103. menu:
  104.     cout << "                                        " << endl; //spacing
  105.     cout << "                  Choose our Service          \n"; //save a string
  106.     cout << "                                        " << endl;
  107.  
  108.     cout << "            [1] - consultation                 " << endl;
  109.     cout << "            [2] - other types of services      " << endl;
  110.     cout << "            [3] - surgery                      " << endl;
  111.     cout << "            [4] - close                        " << endl;
  112.  
  113.     cout << "\n           Please enter your choice: ";
  114.     getline(cin, option);
  115.  
  116.  
  117.  
  118.     if (option == "1")
  119.     {
  120.         cout << "          \n\n" << endl;
  121.         cout << "   You have chosen consultation service                           \n" << endl;
  122.         cout << "   Please wait for your name to be called in front of room 1 to 5           \n\n\n" << endl;
  123.         system("color 0");
  124.         system("pause");
  125.         system("cls");
  126.         string c_option;
  127.  
  128.         cout << "           Welcome to Consultation Department   \n\n\n";   //save a string
  129.         cout << "                What is your problem ?      \n" << endl;
  130.         cout << "            [1] - Flu                           " << endl;
  131.         cout << "            [2] - Wound                         " << endl;
  132.         cout << "            [3] - Cough                         " << endl;
  133.         cout << "            [4] - previous Menu                 " << endl;
  134.         cout << "\          Please enter your choice:   ";
  135.         getline(cin, c_option);
  136.  
  137.         cout << "\n\n\n\n";
  138.         system("pause");
  139.  
  140.         if (c_option == "1")
  141.         {
  142. check_temp:
  143.             string temp;
  144.             float temp2;
  145.             float temp_value=0.0F;
  146.             cout << " \n\n " ; //spacing
  147.             cout << "      What is your body temperature?       \n\n";
  148.             cout<< "\t\tEnter here:";
  149.             //getline(cin, temp);
  150.             cin >> temp_value;
  151.             cout << "\n\n";
  152.             if (temp_value > 39.0)
  153.             {
  154.                 cout << "      You need to be checked and warded      " << endl;
  155.                 system("pause");
  156.                 system("cls");
  157.  
  158.                 total_bill = total_bill + 10;
  159.                 print_bill(total_bill);
  160.             }
  161.             else
  162.             {
  163.                 cout << "        You have a normal fever              " << endl;
  164.                 system("pause");
  165.                 system("cls");
  166.                 total_bill = total_bill + 10;
  167.                 print_bill(total_bill);
  168.             }
  169.  
  170.  
  171.         }
  172.  
  173.  
  174.         if (c_option == "2")
  175.         {
  176.  
  177.             cout << "       The wound need to be disinfect and bandaged      " << endl;
  178.  
  179.             system("cls");
  180.             total_bill = total_bill + 10;
  181.             print_bill(total_bill);
  182.  
  183.         }
  184.         if (c_option == "3")
  185.         {
  186.  
  187.             string cf_option;
  188.             cout << "       Does your tonsil have inflammation: [Y/N]?     " << endl;
  189.             cout << "Enter here:";
  190.             getline(cin, cf_option);
  191.             if (cf_option == "Y" || cf_option =="y")
  192.             {
  193.                 cout << "\n\n";
  194.                 total_bill = total_bill + 10;
  195.                 goto check_temp;
  196.             }
  197.             else
  198.             {
  199.                 cout << "      Display “You have normal cough     " << endl;
  200.  
  201.                 system("cls");
  202.                 total_bill = total_bill + 10;
  203.                 print_bill(total_bill);
  204.             }
  205.             cout << "\n\n";
  206.         }
  207.         if (c_option == "4")
  208.         {
  209.             goto menu;
  210.  
  211.  
  212.         }
  213.         cout << "\n\n\n\n";
  214.         system("pause");
  215.     }//if
  216.  
  217.     other_option:
  218.     if (option == "2") {
  219.  
  220.         system("color 0");
  221.         system("pause");
  222.         system("cls");
  223.  
  224.         cout << "               Other types Service Department   \n\n"; //save a string
  225.  
  226.         cout << "            You have chosen the other type service                      \n" << endl;
  227.         cout << "    Please wait for your name to be called in front of room 9 to 10       \n\n" << endl;
  228.         cout << "    How was your health issue? " << endl;
  229.         cout << "    Is it serious issue[Y/N]? \n"<< endl;
  230.         cout << "Enter here: ";
  231.         string o_option;
  232.         getline(cin, o_option);
  233.         cout << "\n";
  234.         if (o_option == "Y" || o_option == "y")
  235.         {
  236.             cout << "  You will be checked thoroughly " << endl;
  237.  
  238.             system("cls");
  239.             total_bill = total_bill + 5;
  240.             print_bill(total_bill);
  241.         }
  242.         else
  243.         {
  244.             cout << "  You will be checked normally " << endl;
  245.  
  246.             system("cls");
  247.             total_bill = total_bill + 5;
  248.             print_bill(total_bill);
  249.         }
  250.         cout << "\n\n\n\n";
  251.         system("pause");
  252.         system("cls");
  253.  
  254.     }
  255.  
  256.     if (option == "3")
  257.     {
  258.         string s_option, sy_option;
  259.         system("pause");
  260.         system("cls");
  261.  
  262.         cout << "            Welcome to Surgery  Department      \n\n"; //save a string
  263.  
  264.  
  265.         cout << "           You have chosen surgery service               " << endl;
  266.         cout << "        Please wait for your name to be called in front of room 6 to 8           " << endl;
  267.         cout << "\n        Do you have set an appointment before this {Y/N]?:    " << endl;
  268.         cout << "Enter here:";
  269.         getline(cin, sy_option);
  270.         cout << "\n\n";
  271.         system("cls");
  272.         if (sy_option == "Y" || sy_option =="y")
  273.         {
  274.             cout << "            Surgery  List                    \n\n";    //save a string
  275.             cout << "           [6] - optometris                " << endl;
  276.             cout << "           [7] - audiologist               " << endl;
  277.             cout << "           [8] - neurology                 " << endl;
  278.             cout << "           [9] - previous Menu             " << endl;
  279.             cout << "\n  What type of surgery do you need:?  \n" << endl;
  280.             cout << "Enter here:";
  281.             getline(cin, s_option);
  282.             if (s_option == "6")
  283.             {
  284.  
  285.  
  286.                 cout << "  Please go to the optometrist department  " << endl;
  287.                 system("cls");
  288.                 total_bill = total_bill + 1500;
  289.                 print_bill(total_bill);
  290.  
  291.             }
  292.             if (s_option == "7")
  293.             {
  294.  
  295.                 cout << "  Please go to the audiologist department  " << endl;
  296.                 system("cls");
  297.                 total_bill = total_bill + 800;
  298.                 print_bill(total_bill);
  299.  
  300.             }
  301.             if (s_option == "8")
  302.             {
  303.  
  304.                 cout << "  Please go to the audiologist department  " << endl;
  305.                 system("cls");
  306.                 total_bill = total_bill + 1500;
  307.                 print_bill(total_bill);
  308.             }
  309.             if (s_option == "9")
  310.             {
  311.                 goto menu;
  312.             }
  313.             cout << "\n\n";
  314.  
  315.  
  316.         }
  317.         else
  318.         {
  319.             cout << "  Set an appointment with the doctor for another day ?  ";
  320.             cout << "\n\n";
  321.             system("cls");
  322.             goto other_option;
  323.  
  324.         }
  325.         cout << "\n\n\n\n";
  326.         system("pause");
  327.         system("color f");
  328.     }
  329.  
  330.  
  331.  
  332.     if (option == "4")
  333.     {
  334.         return 0;
  335.     }
  336.  
  337.  
  338. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement