Advertisement
andrefecto

Input isn't what I wanted

Nov 6th, 2013
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.03 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.  
  51.   // intitalizations
  52.   accNumber = 0.0;
  53.  
  54.   // input
  55.   cout << "Please Enter Account Number:";
  56.  
  57.   cin >> accNumber;
  58.   // Procesas
  59.   // output
  60.   // prolouge
  61.   return accNumber;
  62. }
  63. /*End Account Number Input*/
  64.  
  65. /*Start Check written input*/
  66. int checksWritten (){
  67.  
  68. // Declarations
  69.  
  70. int written;
  71. // Initalizations
  72.  
  73. written = 0.0;
  74.  
  75. // Input
  76. cout <<"Please input the amount of checks you have written this month:";
  77. cin >> written;
  78.  
  79. // Output
  80.  
  81. // Prolouge
  82.  
  83. return written;
  84.  
  85. }
  86. /*End Check written input*/
  87.  
  88. /*Start Account Type*/
  89. char accType (){
  90.  
  91. // Declarations
  92.  
  93. char answer;
  94. int numberBySwitch;
  95.  
  96. // Initalizations
  97.  
  98. numberBySwitch = 1;
  99.  
  100. // Input
  101. cout << "Please Enter the acount type (C for Comerical and P for Personal):";
  102. cin >> answer;
  103. // Process
  104.  
  105. switch (answer){
  106.  
  107. case 'p':
  108.     numberBySwitch += 2;
  109.     checksWritten();break;
  110. case 'P':
  111.     numberBySwitch += 2;break;
  112. case 'c':
  113.     numberBySwitch += 2;break;
  114. case 'C':
  115.     numberBySwitch += 2;break;
  116. default:
  117.     if(numberBySwitch == 1) {
  118.         cout << "Error! Please enter a correct type!" <<endl;
  119.         accType();break;
  120.     }
  121. }
  122.  
  123. // Output
  124.  
  125. // Prolouge
  126. return answer;
  127. }
  128. /*End Account Type*/
  129.  
  130. /*Start Main*/
  131. int main(){
  132.  
  133.   // Declarations
  134.  
  135.   int accountNumb;
  136.   char theirAccType;
  137.   int writtenChecks;
  138.   // Initalizations
  139.  
  140.   accountNumb = 0;
  141.   writtenChecks = 0;
  142.  
  143.   // Input
  144.   displayInstructions();
  145.   //accountNumb = readAccNumb();
  146.   theirAccType = accType();
  147.   //writtenChecks = checksWritten();
  148.  
  149.   // Output
  150. cout << endl;
  151. cout << "Account Type: " << theirAccType << endl;
  152. //cout << "account type number: " << numberBySwitch <<endl;
  153.  
  154.   // Prolouge
  155.  
  156.  return 0;
  157.  
  158. }
  159. /*End Main*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement