Advertisement
rolandixor

Untitled

Aug 21st, 2012
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 6.35 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cctype>
  4. //#include <evillaugh>
  5. //#include <listofdisturbinginstruments>
  6.  
  7. using namespace std;
  8. //using namespace jumpoutofskin;
  9.  
  10. //functions of our own;
  11. void welcomen();
  12. void amigo();
  13.  
  14. //class is in session. Take your books out!
  15. class Payment
  16. {
  17.     private:
  18.         int type;
  19.         double amount;
  20.     public:
  21.         Payment();
  22.         Payment(int, double);
  23.         void displayPayment();
  24.         double getAmount(); //I hope it's a lot of cash
  25. };
  26.  
  27. /**
  28. random comment.
  29.  
  30. Functions implented here:
  31. **/
  32.  
  33. Payment::Payment()
  34. {
  35.     type = 30;
  36.     amount = 0.00;
  37. }
  38.  
  39. Payment::Payment(int typein, double amountin)
  40. {
  41.     type=typein;
  42.     amount=amountin;
  43. }
  44.  
  45. void Payment::displayPayment()
  46. {
  47.     string type1 = "Cash"; //:P cash!!!
  48.     string type2 = "Credit Card"; //credit cardit
  49.     string type3 = "Cheque"; //be "shore" to check that it's valid.
  50.     string error = "Error, using defaults"; //will use Cash. pay up, or face the lack of consequences
  51.  
  52.     if(type!=30&&type!=31&&type!=32)
  53.         {
  54.             cout<<"Invalid payment type. Using defaults!";
  55.             cout<<endl;
  56.             type=30;
  57.         }
  58.     if(type==30)
  59.         {
  60.             cout<<"The Payment type is: ";
  61.             cout<<type1<<endl;
  62.         }
  63.     if(type==31)
  64.         {
  65.             cout<<"The Payment type is: ";
  66.             cout<<type2<<endl;
  67.         }
  68.     if(type==32)
  69.         {
  70.             cout<<"The Payment type is: ";
  71.             cout<<type3<<endl;
  72.         }
  73.     cout<<"The amount deposited is: $";
  74.     cout<<amount;
  75. }
  76.  
  77. double Payment::getAmount()
  78. {
  79.     return amount;
  80. }
  81.  
  82. class Surgery //scalpel... saw... wrench... hammer... goat... car tyre... boat...
  83. {
  84.     private:
  85.         int SurgeryIdNumber;
  86.         string Name;
  87.         string NextOfKin;
  88.         string slightlydisturbingbutnecessaryinstrument;
  89.         Payment PaymentMethod;
  90.     public:
  91.         Surgery(int, string, string, string, int, double);
  92.         void displaySurgery();
  93. };
  94.  
  95.  
  96. /**
  97.  * doxygen style comment.
  98.  * function implementations and such like and such and such.
  99.  * the functions that come first are from surgery.
  100.  * this is because we want to jump to the fun part first.
  101.  * not really. it's to keep things organized.
  102.  **/
  103.  
  104. Surgery::Surgery(int id, string namely, string kin, string errr, int typein, double amountin):PaymentMethod(typein, amountin)
  105. {
  106.     SurgeryIdNumber=id;
  107.     Name=namely;
  108.     NextOfKin=kin;
  109.     slightlydisturbingbutnecessaryinstrument=errr;
  110.     PaymentMethod.getAmount();
  111. }
  112.  
  113. void Surgery::displaySurgery()
  114. {
  115.     cout<<"The Surgery Id number is: "<<SurgeryIdNumber;
  116.     cout<<endl;
  117.     cout<<"The Patient Name is: "<<Name;
  118.     cout<<endl;
  119.     cout<<"The Next Of Kin is: "<<NextOfKin;
  120.     cout<<endl;
  121.     cout<<"A slighty disturbing instrument will be used during the surgery.";
  122.     cout<<endl;
  123.     cout<<"This is the instrument type: '";//jackhammer
  124.     cout<<slightlydisturbingbutnecessaryinstrument<<"'"; //so disturbing...
  125.     cout<<endl;
  126.     PaymentMethod.displayPayment();
  127.     cout<<endl;
  128.     cout<<endl<<endl;
  129. }
  130.  
  131. void welcomen()
  132. {
  133.     /*
  134.     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.
  135.     example (in ta'ela).
  136.     Heyah.
  137.     Sha'alom a St. Micha'el intelecta...
  138.     */
  139.  
  140.     //seriously now, this outputs the welcome message :)
  141.     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.
  142.     cout<<"This program will help you to manage surgeries"<<endl; //muhahahaha... I can feel it now. Where is our first patient.
  143.     cout<<"Follow the instructions on screen to get going."<<endl<<endl; //bleh! instruction manuals are for humans!
  144.     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!
  145.     amigo();
  146. }
  147.  
  148. void amigo() //makes sure the user is ready continue.
  149. {
  150. int cont = 0;
  151.  
  152.     while(cont !=1)
  153.     {
  154.         cout<<"Hit enter when you are ready to continue.\n\nThis is done to ensure you are following the instructions"<<endl<<endl;
  155.         cin.get();
  156.         cout<<endl;
  157.         cont=1;
  158.     };
  159. }
  160.  
  161. int main()
  162. {
  163.     welcomen();
  164.  
  165.     int surgerynum;
  166.     double amtdue;
  167.     double change;
  168.  
  169.     //variables for the surg1 object
  170.     int id;
  171.     int typestyle;
  172.     double howmuch;
  173.     string name;
  174.     string kin;
  175.     string payment;
  176.     string surgid;
  177.     string disturbing;
  178.  
  179.         //this variable will check for if the user wants to continue with our disturbing little programme #include <evillaugh>
  180.         string choice="";
  181.  
  182.     Surgery surg0(354, "Jack T. H. E. Mender", "Jack D. A. Flipper", "Mass Spectrometer", 30, 6100.00);
  183.     surg0.displaySurgery();
  184.     cout<<"The change for this customer is: $";
  185.     change=100;
  186.     cout<<change;
  187.  
  188.     //surg1 object
  189.     Surgery surg1(int id, string kin, string payment, string surgid, string disturbing, int typestyle, double howmuch);
  190.  
  191.     cout<<"Now you manage today's surgeries"<<endl;
  192.     cout<<"Would you like to continue?"<<endl<<"yes/no"<<endl;
  193.     cin>>choice;
  194.     cout<<endl;
  195.     while(choice=="yes"||choice=="YES"||choice=="Yes"||choice=="yES"||choice=="YeS"||choice=="yeS"||choice=="YEs"&&choice!="no"&&choice!="No"&&choice!="nO"&&choice!="NO")
  196.     {
  197.         cout<<"Please follow all instructions carefully"<<endl;
  198.         cout<<"Please enter the Sugery id:"<<endl;
  199.         cin>>id;
  200.         cout<<endl;
  201.         cout<<"Please enter the name:"<<endl;
  202.         getline(cin,name);
  203.         cout<<"Please enter the next of kin:"<<endl;
  204.         getline(cin,kin);
  205.         cout<<"Please enter the surgery id:"<<endl;
  206.         cin>>surgid;
  207.         cout<<"Please choose which slightly disturbing, but necessary instrument will be used in this surgery."<<endl;
  208.         cout<<"An example: Umbrella"<<endl;
  209.         cin>>disturbing;
  210.         cout<<"Please enter the payment type:"<<endl;
  211.         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.
  212.         cout<<"Please enter the cost of the surgery/amount owed"<<endl;
  213.         cin>>howmuch;
  214.         surg1.displaySurgery();
  215.  
  216.         cout<<"Transaction completed"<<endl;
  217.         cout<<endl;
  218.         cout<<"Would you like to continue?"<<endl;
  219.         cin>>choice;
  220.  
  221.     }
  222.  
  223.     cin.get();
  224.     return 0;
  225. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement