Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include<conio.h>
- using namespace std;
- int cust_num, btype, amtdis;
- double a = 0, b = 0, ab = 0, o = 0;
- char sex;
- double NOL, amt;
- string disp;
- char con;
- int main() {
- cout <<fixed<<setprecision(2);
- cout << "Costumer Number: ";
- cin >> cust_num;
- cout << "Costumer Number: " << cust_num << endl;
- cout << "SEX input ('M' for male) and ('F' for female): ";
- cin >> sex;
- sex = toupper(sex);
- if (sex == 'F') {
- cout << "\nYou are a female.\n";
- } else if (sex == 'M') {
- cout << "\nYou are a male\n";
- } else {
- cout << "\nInvalid input\nTry again";
- system("clear");
- main();
- }
- cout << "\nBlood type code is:\n1 - 'A'\n2 - 'B'\n3 - 'AB'\n4 - 'O'\nEnter your Blood Type: ";
- cin >> btype;
- if (btype == 1) {
- cout << "\nYour blood type is A.\n";
- cout << "\nInput the amount for liters of blood: ";
- cin >> NOL;
- amt = (500 * NOL) + (40.0025 * NOL);
- cout << "\nTo be paid: " << amt << endl;
- cout << "\nDon't display total payment of bloodtype (yes/no): ";
- cin >> disp;
- if (disp == "no") {
- if (btype == 1) {
- a += amt;
- }
- } else{
- cout<<"+-----------------------------------------------------------+"<<endl;
- cout<<"| Dracula’s Blood Bank |"<<endl;
- cout<<"| Horror City |"<<endl;
- cout<<"+-----------------------------------------------------------+"<<endl;
- cout<<"| Customer Number | Sex | Blood Type | No. of Liters |"<<endl;
- cout<<"+-----------------------------------------------------------+"<<endl;
- }
- }
- if (btype == 2) {
- cout << "\nYour blood type is B.\n";
- cout << "\nInput the amount for liters of blood: ";
- cin >> NOL;
- amt = (3500 * 3) + (40.0025 * (NOL - 3));
- cout << "\nTo be paid: " << amt << endl;
- cout << "\nDon't display total payment of bloodtype (yes/no): ";
- cin >> disp;
- if (disp == "no") {
- if (btype == 2) {
- b = b + amt;
- }
- }else{
- cout<<"+-----------------------------------------------------------+"<<endl;
- cout<<"| Dracula’s Blood Bank |"<<endl;
- cout<<"| Horror City |"<<endl;
- cout<<"+-----------------------------------------------------------+"<<endl;
- cout<<"| Customer Number | Sex | Blood Type | No. of Liters |"<<endl;
- cout<<"+-----------------------------------------------------------+"<<endl;
- }
- }
- if (btype == 3) {
- cout << "\nYour blood type is AB.\n";
- cout << "\nInput the amount for liters of blood: ";
- cin >> NOL;
- if (NOL == 4) {
- amt = (6000 * NOL);
- cout << "\nTo be paid: " << amt << endl;
- } else if (NOL > 4 && NOL < 7) {
- amt = (7000 * NOL);
- cout << "\nTo be paid: " << amt << endl;
- } else if (NOL >= 7) {
- amt = (10000 * NOL) + (1.75 * NOL);
- cout << "\nTo be paid: " << amt << endl;
- }
- cout << "\nDon't display total payment of bloodtype (yes/no): ";
- cin >> disp;
- if (disp == "no") {
- if (btype == 3) {
- ab = ab + amt;
- }
- }else{
- cout<<"+-----------------------------------------------------------+"<<endl;
- cout<<"| Dracula’s Blood Bank |"<<endl;
- cout<<"| Horror City |"<<endl;
- cout<<"+-----------------------------------------------------------+"<<endl;
- cout<<"| Customer Number | Sex | Blood Type | No. of Liters |"<<endl;
- cout<<"+-----------------------------------------------------------+"<<endl;
- }
- }
- if (btype == 4) {
- cout << "\nYour blood type is O.\n";
- cout << "\nInput the amount for liters of blood: ";
- cin >> NOL;
- amt = (NOL * 500);
- cout << "\nTo be paid: " << amt << endl;
- cout << "\nDon't display total payment of bloodtype (yes/no): ";
- cin >> disp;
- if (disp == "no") {
- if (btype == 4) {
- o = o + amt;
- }
- }else{
- cout<<"+-----------------------------------------------------------+"<<endl;
- cout<<"| Dracula’s Blood Bank |"<<endl;
- cout<<"| Horror City |"<<endl;
- cout<<"+-----------------------------------------------------------+"<<endl;
- cout<<"| Customer Number | Sex | Blood Type | No. of Liters |"<<endl;
- cout<<"+-----------------------------------------------------------+"<<endl;
- }
- }
- cout << "\nA = " << a << endl;
- cout << "\nB = " << b << endl;
- cout << "\nAB =" << ab << endl;
- cout << "\nO = " << o << endl;
- cout << "Input for another user? (Y/N): ";
- cin >> con;
- if (con == 'Y') {
- system("clear");
- main();
- } else {
- cout << "\nProgram Stopped";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement