Advertisement
Kulas_Code20

BloodBank

Oct 21st, 2021
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.44 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include<conio.h>
  4.  
  5. using namespace std;
  6. int cust_num, btype, amtdis;
  7. double a = 0, b = 0, ab = 0, o = 0;
  8. char sex;
  9. double NOL, amt;
  10. string disp;
  11. char con;
  12. int main() {
  13.     cout <<fixed<<setprecision(2);
  14.     cout << "Costumer Number: ";
  15.     cin >> cust_num;
  16.     cout << "Costumer Number: " << cust_num << endl;
  17.     cout << "SEX input ('M' for male) and ('F' for female): ";
  18.     cin >> sex;
  19.     sex = toupper(sex);
  20.     if (sex == 'F') {
  21.         cout << "\nYou are a female.\n";
  22.     } else if (sex == 'M') {
  23.         cout << "\nYou are a male\n";
  24.     } else {
  25.         cout << "\nInvalid input\nTry again";
  26.         system("clear");
  27.         main();
  28.     }
  29.  
  30.     cout << "\nBlood type code is:\n1 - 'A'\n2 - 'B'\n3 - 'AB'\n4 - 'O'\nEnter your Blood Type: ";
  31.     cin >> btype;
  32.     if (btype == 1) {
  33.         cout << "\nYour blood type is A.\n";
  34.         cout << "\nInput the amount for liters of blood: ";
  35.         cin >> NOL;
  36.  
  37.         amt = (500 * NOL) + (40.0025 * NOL);
  38.         cout << "\nTo be paid: " << amt << endl;
  39.         cout << "\nDon't display total payment of bloodtype (yes/no): ";
  40.         cin >> disp;
  41.  
  42.         if (disp == "no") {
  43.             if (btype == 1) {
  44.                 a += amt;
  45.             }
  46.         } else{
  47.             cout<<"+-----------------------------------------------------------+"<<endl;
  48.             cout<<"|                Dracula’s Blood Bank                       |"<<endl;
  49.             cout<<"|                     Horror City                           |"<<endl;
  50.             cout<<"+-----------------------------------------------------------+"<<endl;
  51.             cout<<"| Customer Number   |   Sex  |  Blood Type  | No. of Liters |"<<endl;
  52.             cout<<"+-----------------------------------------------------------+"<<endl;
  53.         }
  54.     }
  55.     if (btype == 2) {
  56.         cout << "\nYour blood type is B.\n";
  57.         cout << "\nInput the amount for liters of blood: ";
  58.         cin >> NOL;
  59.  
  60.         amt = (3500 * 3) + (40.0025 * (NOL - 3));
  61.         cout << "\nTo be paid: " << amt << endl;
  62.         cout << "\nDon't display total payment of bloodtype (yes/no): ";
  63.         cin >> disp;
  64.  
  65.         if (disp == "no") {
  66.             if (btype == 2) {
  67.                 b = b + amt;
  68.             }
  69.         }else{
  70.             cout<<"+-----------------------------------------------------------+"<<endl;
  71.             cout<<"|                Dracula’s Blood Bank                       |"<<endl;
  72.             cout<<"|                     Horror City                           |"<<endl;
  73.             cout<<"+-----------------------------------------------------------+"<<endl;
  74.             cout<<"| Customer Number   |   Sex  |  Blood Type  | No. of Liters |"<<endl;
  75.             cout<<"+-----------------------------------------------------------+"<<endl;
  76.         }
  77.     }
  78.     if (btype == 3) {
  79.         cout << "\nYour blood type is AB.\n";
  80.         cout << "\nInput the amount for liters of blood: ";
  81.         cin >> NOL;
  82.  
  83.         if (NOL == 4) {
  84.             amt = (6000 * NOL);
  85.             cout << "\nTo be paid: " << amt << endl;
  86.  
  87.         } else if (NOL > 4 && NOL < 7) {
  88.             amt = (7000 * NOL);
  89.             cout << "\nTo be paid: " << amt << endl;
  90.  
  91.         } else if (NOL >= 7) {
  92.             amt = (10000 * NOL) + (1.75 * NOL);
  93.             cout << "\nTo be paid: " << amt << endl;
  94.         }
  95.         cout << "\nDon't display total payment of bloodtype (yes/no): ";
  96.         cin >> disp;
  97.         if (disp == "no") {
  98.             if (btype == 3) {
  99.                 ab = ab + amt;
  100.             }
  101.         }else{
  102.             cout<<"+-----------------------------------------------------------+"<<endl;
  103.             cout<<"|                Dracula’s Blood Bank                       |"<<endl;
  104.             cout<<"|                     Horror City                           |"<<endl;
  105.             cout<<"+-----------------------------------------------------------+"<<endl;
  106.             cout<<"| Customer Number   |   Sex  |  Blood Type  | No. of Liters |"<<endl;
  107.             cout<<"+-----------------------------------------------------------+"<<endl;
  108.         }
  109.     }
  110.  
  111.     if (btype == 4) {
  112.         cout << "\nYour blood type is O.\n";
  113.         cout << "\nInput the amount for liters of blood: ";
  114.         cin >> NOL;
  115.         amt = (NOL * 500);
  116.         cout << "\nTo be paid: " << amt << endl;
  117.         cout << "\nDon't display total payment of bloodtype (yes/no): ";
  118.         cin >> disp;
  119.         if (disp == "no") {
  120.             if (btype == 4) {
  121.                 o = o + amt;
  122.             }
  123.         }else{
  124.             cout<<"+-----------------------------------------------------------+"<<endl;
  125.             cout<<"|                Dracula’s Blood Bank                       |"<<endl;
  126.             cout<<"|                     Horror City                           |"<<endl;
  127.             cout<<"+-----------------------------------------------------------+"<<endl;
  128.             cout<<"| Customer Number   |   Sex  |  Blood Type  | No. of Liters |"<<endl;
  129.             cout<<"+-----------------------------------------------------------+"<<endl;
  130.         }
  131.     }
  132.     cout << "\nA = " << a << endl;
  133.     cout << "\nB = " << b << endl;
  134.     cout << "\nAB =" << ab << endl;
  135.     cout << "\nO = " << o << endl;
  136.  
  137.     cout << "Input for another user? (Y/N): ";
  138.     cin >> con;
  139.  
  140.     if (con == 'Y') {
  141.         system("clear");
  142.         main();
  143.     } else {
  144.         cout << "\nProgram Stopped";
  145.     }
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement