Advertisement
andrefecto

Runs twice

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