Advertisement
andrefecto

Account Type runs twice

Nov 8th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.91 KB | None | 0 0
  1. /*
  2. project3.cpp
  3. Andre Fecteau
  4. CSC135-101
  5. October 29, 2013
  6. This program prints a bank's service fees per month depending on account type
  7. */
  8. /*start Must Haves*/
  9. #include <iostream>
  10. using namespace std;
  11. /*End Must Haves*/
  12.  
  13. /*
  14. Basic Function for Copy Paste
  15. <function type> <function name> (){
  16.  
  17. // Declarations
  18. // Initalizations
  19. // Input
  20. // Process
  21. // Output
  22. // Prolouge
  23. }
  24. */
  25.  
  26. /*Start Display Instructions*/
  27. void displayInstructions (){
  28. // Declarations
  29. // Initalizations
  30. // Input
  31. // Process
  32. // Output
  33. cout <<"| -------------------------------------------------------------- |" << endl;
  34. cout <<"| ---------- Welcome to the bank fee calculator ---------------- |" << endl;
  35. cout <<"| -------------------------------------------------------------- |" << endl;
  36. cout <<"| This Program wil ask you to eneter your account number.        |" << endl;
  37. cout <<"| Then it will ask for your account type Personal or Commercial. |" << endl;
  38. cout <<"| Then ask for the amount of checks you have written.            |" << endl;
  39. cout <<"| Lastly it will output how much your fees are for this month.   |" << endl;
  40. cout <<"| -------------------------------------------------------------- |" << endl;
  41. cout << endl;
  42. // Prolouge
  43. }
  44. /*End Display Instructions*/
  45.  
  46. /*Start Account Number Input*/
  47. int readAccNumb(){
  48.   // delarations
  49.   int accNumber;
  50.   // intitalizations
  51.   accNumber = 0.0;
  52.   // input
  53.   cout << "Please Enter Account Number:";
  54.   cin >> accNumber;
  55.   // Procesas
  56.   // output
  57.   // prolouge
  58.   return accNumber;
  59. }
  60. /*End Account Number Input*/
  61.  
  62. /*Start Check written input*/
  63. int checksWritten (){
  64. // Declarations
  65. int written;
  66. // Initalizations
  67. written = 0.0;
  68. // Input
  69. cout <<"Please input the amount of checks you have written this month:";
  70. cin >> written;
  71. // Output
  72. // Prolouge
  73. return written;
  74. }
  75. /*End Check written input*/
  76.  
  77. /*Start Account Type*/
  78. char accType (){
  79. // Declarations
  80. char answer;
  81. int numberBySwitch;
  82. // Initalizations
  83. numberBySwitch = 1;
  84. // Input
  85. while (numberBySwitch == 1){
  86.     cout << "Please Enter the acount type (C for Comerical and P for Personal):";
  87.     cin >> answer;
  88. // Process
  89. switch (answer){
  90.     case 'p':
  91.         answer = 'P';
  92.         numberBySwitch += 2;break;
  93.     case 'P':
  94.         numberBySwitch += 2;break;
  95.     case 'c':
  96.         answer = 'C';
  97.         numberBySwitch += 3;break;
  98.     case 'C':
  99.         numberBySwitch += 3;break;
  100.     default:
  101.         if(numberBySwitch == 1) {
  102.         cout << "Error! Please enter a correct type!" <<endl;
  103.         }
  104.     }
  105. }
  106. // Output
  107. // Prolouge
  108. return answer;
  109. }
  110. /*End Account Type*/
  111.  
  112. /*Being Commercial Account*/
  113. int commericalCalc(int checksWritten){
  114. // Declarations
  115. int written;
  116. int checkPrice;
  117. // Initalizations
  118. checkPrice = 0.0;
  119. // Input
  120. // Process
  121. if(written < 20){
  122.     checkPrice = 0.10;
  123. }
  124. // Output
  125. // Prolouge
  126. return checkPrice;
  127. }
  128. /*End Commerical Account*/
  129.  
  130. /*begin personal account*/
  131. int personalCalc(int checksWritten){
  132.  
  133. }
  134. /*end personal calc*/
  135.  
  136. /*begin personal*/
  137.  
  138. /*end personal*/
  139.  
  140. /*begin commerical*/
  141. /*end commerical*/
  142.  
  143. /*Being split*/
  144. double pricePerCheck(char accType, int checksWritten){
  145. // Declarations
  146. double price;
  147. // Initalizations
  148. price = 0.0;
  149. // Input
  150. // Process
  151. if(accType == 'P'){
  152. }
  153. if(accType == 'C'){
  154.     if(checksWritten < 20){
  155.         price = 0.10;
  156.     }
  157. }
  158. // Output
  159. // Prolouge
  160. return price;
  161. }
  162. /*End split*/
  163.  
  164. /*Start Main*/
  165. int main(){
  166.  
  167.   // Declarations
  168.  
  169.   int accountNumb;
  170.   char theirAccType;
  171.   int writtenChecks;
  172.   double split;
  173.   // Initalizations
  174.  
  175.   accountNumb = 0.0;
  176.   writtenChecks = 0.0;
  177.   split = 0.0;
  178.   theirAccType = ' ';
  179.  
  180.   // Input
  181.   displayInstructions();
  182.   accountNumb = readAccNumb();
  183.   theirAccType = accType();
  184.   pricePerCheck(accType(), checksWritten());
  185.  
  186.  
  187.   // Output
  188. cout << endl;
  189. cout << "Account Type: " << theirAccType << endl;
  190. cout << "Check Price: " << endl;
  191.  
  192.   // Prolouge
  193.  
  194.  return 0;
  195.  
  196. }
  197. /*End Main*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement