Guest User

Untitled

a guest
Oct 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <iomanip>
  4. using namespace std;
  5.  
  6. float balance;
  7. void balanceStatment(){
  8. cout << "Your current balance is: $" << balance << endl;
  9. }
  10.  
  11. void asker(){
  12.  
  13. float deposit;
  14. float withdraw;
  15. char answer;
  16.  
  17. balanceStatment();
  18.  
  19. cout << "Please enter a new amount you would like to deposit: ";
  20.  
  21. cin >> deposit;
  22.  
  23. balance = balance + deposit;
  24.  
  25. cout << "Your new balance is: " << balance << endl;
  26.  
  27. cout << "Would you like to make a withdraw(Y = yes, N = no)?" << endl;
  28. cin >> answer;
  29. if (toupper(answer) == 'Y'){
  30. cout << "How much would you like to withdraw? ";
  31. cin >> withdraw;
  32. balance = balance - withdraw;
  33. }
  34. }
  35.  
  36. void calculateInterest(){
  37. float interest = 0.08;
  38. float interest_recived;
  39. interest_recived = balance * interest;
  40. cout << "The amount you will recive in interest is $" << << setiosflags(ios::fixed) << setprecision(2) << interest_recived << endl;
  41.  
  42. }
  43.  
  44. void main(){
  45. asker();
  46. calculateInterest();
  47. balanceStatment();
  48. system("pause");
  49. }
Add Comment
Please, Sign In to add comment