Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <cctype>
- //#include <evillaugh>
- //#include <listofdisturbinginstruments>
- using namespace std;
- //using namespace jumpoutofskin;
- //functions of our own;
- void welcomen();
- void amigo();
- //class is in session. Take your books out!
- class Payment
- {
- private:
- int type;
- double amount;
- public:
- Payment();
- Payment(int, double);
- void displayPayment();
- double getAmount(); //I hope it's a lot of cash
- };
- /**
- random comment.
- Functions implented here:
- **/
- Payment::Payment()
- {
- type = 30;
- amount = 0.00;
- }
- Payment::Payment(int typein, double amountin)
- {
- type=typein;
- amount=amountin;
- }
- void Payment::displayPayment()
- {
- string type1 = "Cash"; //:P cash!!!
- string type2 = "Credit Card"; //credit cardit
- string type3 = "Cheque"; //be "shore" to check that it's valid.
- string error = "Error, using defaults"; //will use Cash. pay up, or face the lack of consequences
- if(type!=30&&type!=31&&type!=32)
- {
- cout<<"Invalid payment type. Using defaults!";
- cout<<endl;
- type=30;
- }
- if(type==30)
- {
- cout<<"The Payment type is: ";
- cout<<type1<<endl;
- }
- if(type==31)
- {
- cout<<"The Payment type is: ";
- cout<<type2<<endl;
- }
- if(type==32)
- {
- cout<<"The Payment type is: ";
- cout<<type3<<endl;
- }
- cout<<"The amount deposited is: $";
- cout<<amount;
- }
- double Payment::getAmount()
- {
- return amount;
- }
- class Surgery //scalpel... saw... wrench... hammer... goat... car tyre... boat...
- {
- private:
- int SurgeryIdNumber;
- string Name;
- string NextOfKin;
- string slightlydisturbingbutnecessaryinstrument;
- Payment PaymentMethod;
- public:
- Surgery(int, string, string, string, int, double);
- void displaySurgery();
- };
- /**
- * doxygen style comment.
- * function implementations and such like and such and such.
- * the functions that come first are from surgery.
- * this is because we want to jump to the fun part first.
- * not really. it's to keep things organized.
- **/
- Surgery::Surgery(int id, string namely, string kin, string errr, int typein, double amountin):PaymentMethod(typein, amountin)
- {
- SurgeryIdNumber=id;
- Name=namely;
- NextOfKin=kin;
- slightlydisturbingbutnecessaryinstrument=errr;
- PaymentMethod.getAmount();
- }
- void Surgery::displaySurgery()
- {
- cout<<"The Surgery Id number is: "<<SurgeryIdNumber;
- cout<<endl;
- cout<<"The Patient Name is: "<<Name;
- cout<<endl;
- cout<<"The Next Of Kin is: "<<NextOfKin;
- cout<<endl;
- cout<<"A slighty disturbing instrument will be used during the surgery.";
- cout<<endl;
- cout<<"This is the instrument type: '";//jackhammer
- cout<<slightlydisturbingbutnecessaryinstrument<<"'"; //so disturbing...
- cout<<endl;
- PaymentMethod.displayPayment();
- cout<<endl;
- cout<<endl<<endl;
- }
- void welcomen()
- {
- /*
- This function exists as a way to keep the main function clean, while including a nice, friendly welcome message (in german, spanish, french, hebrew, or swahilli.
- example (in ta'ela).
- Heyah.
- Sha'alom a St. Micha'el intelecta...
- */
- //seriously now, this outputs the welcome message :)
- cout<<"Welcome to St.Michael University Hosptital"<<endl;//where the nurses actually check to see if you have died or not! unlike some places we know... ehem.
- cout<<"This program will help you to manage surgeries"<<endl; //muhahahaha... I can feel it now. Where is our first patient.
- cout<<"Follow the instructions on screen to get going."<<endl<<endl; //bleh! instruction manuals are for humans!
- cout<<"Remember to notify the developer(s) of any bugs (errors) you encounter."<<endl<<endl; //you know, like T.reX, Venus fly-traps 10 feet tall. those kinds of bugs 0.o ,.. gasp! If you find anything like that, don't report it, just run!
- amigo();
- }
- void amigo() //makes sure the user is ready continue.
- {
- int cont = 0;
- while(cont !=1)
- {
- cout<<"Hit enter when you are ready to continue.\n\nThis is done to ensure you are following the instructions"<<endl<<endl;
- cin.get();
- cout<<endl;
- cont=1;
- };
- }
- int main()
- {
- welcomen();
- int surgerynum;
- double amtdue;
- double change;
- //variables for the surg1 object
- int id;
- int typestyle;
- double howmuch;
- string name;
- string kin;
- string payment;
- string surgid;
- string disturbing;
- //this variable will check for if the user wants to continue with our disturbing little programme #include <evillaugh>
- string choice="";
- Surgery surg0(354, "Jack T. H. E. Mender", "Jack D. A. Flipper", "Mass Spectrometer", 30, 6100.00);
- surg0.displaySurgery();
- cout<<"The change for this customer is: $";
- change=100;
- cout<<change;
- //surg1 object
- Surgery surg1(int id, string kin, string payment, string surgid, string disturbing, int typestyle, double howmuch);
- cout<<"Now you manage today's surgeries"<<endl;
- cout<<"Would you like to continue?"<<endl<<"yes/no"<<endl;
- cin>>choice;
- cout<<endl;
- while(choice=="yes"||choice=="YES"||choice=="Yes"||choice=="yES"||choice=="YeS"||choice=="yeS"||choice=="YEs"&&choice!="no"&&choice!="No"&&choice!="nO"&&choice!="NO")
- {
- cout<<"Please follow all instructions carefully"<<endl;
- cout<<"Please enter the Sugery id:"<<endl;
- cin>>id;
- cout<<endl;
- cout<<"Please enter the name:"<<endl;
- getline(cin,name);
- cout<<"Please enter the next of kin:"<<endl;
- getline(cin,kin);
- cout<<"Please enter the surgery id:"<<endl;
- cin>>surgid;
- cout<<"Please choose which slightly disturbing, but necessary instrument will be used in this surgery."<<endl;
- cout<<"An example: Umbrella"<<endl;
- cin>>disturbing;
- cout<<"Please enter the payment type:"<<endl;
- cin>>typestyle; //used typestyle here because type matches too many C++ statements, conflicting with autocomplete on some IDE's, and not wise for compatibility with most naming conventions.
- cout<<"Please enter the cost of the surgery/amount owed"<<endl;
- cin>>howmuch;
- surg1.displaySurgery();
- cout<<"Transaction completed"<<endl;
- cout<<endl;
- cout<<"Would you like to continue?"<<endl;
- cin>>choice;
- }
- cin.get();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement