Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <iomanip>
- using namespace std;
- float balance;
- void balanceStatment(){
- cout << "Your current balance is: $" << balance << endl;
- }
- void asker(){
- float deposit;
- float withdraw;
- char answer;
- balanceStatment();
- cout << "Please enter a new amount you would like to deposit: ";
- cin >> deposit;
- balance = balance + deposit;
- cout << "Your new balance is: " << balance << endl;
- cout << "Would you like to make a withdraw(Y = yes, N = no)?" << endl;
- cin >> answer;
- if (toupper(answer) == 'Y'){
- cout << "How much would you like to withdraw? ";
- cin >> withdraw;
- balance = balance - withdraw;
- }
- }
- void calculateInterest(){
- float interest = 0.08;
- float interest_recived;
- interest_recived = balance * interest;
- cout << "The amount you will recive in interest is $" << << setiosflags(ios::fixed) << setprecision(2) << interest_recived << endl;
- }
- void main(){
- asker();
- calculateInterest();
- balanceStatment();
- system("pause");
- }
Add Comment
Please, Sign In to add comment