************Hello dont do 5 and 6. I got stuck on doing the funtions of Question
ID: 3705243 • Letter: #
Question
************Hello dont do 5 and 6. I got stuck on doing the funtions of Question 4 that belong to the Bank.cpp. thats the only part I need done. I already did 1-3 below are my codes for those questions. They are needed to do Bank.cpp I believe. Files are Account.cpp, Account_main.cpp, and ACCOUNT.h. I took the screech shots well so you are not missing information.Thank you in advance.******************
// file: Account.cpp
// 4/4/2018
//
#include< iostream>
#include "ACCOUNT.h"
using namespace std;
Account:: Account(): balance(0) {}
Account:: Account(double amount,double rate): balance(amount), interest_rate(rate){}
void Account::deposit(double amount)
{
balance += amount;
}
bool Account::withdraw(double amount)
{
bool status;
if (amount> balance){
balance -= 5; //penalty
status = false;
} else{
balance -= amount;
status =true;
}
return status;
}
double Account::query()
{return balance;}
void Account::set_interest_rate(double rate)
{ interest_rate=rate; }
double Account::get_interest_rate()
{return interest_rate; }
void Account::add_interest()
{
balance=balance+balance*interest_rate/100.0;
}
// file: Account_main.cpp
// 4/4/2018
#include<iostream>
#include "ACCOUNT.h"
using namespace std;
main()
{
Account savings(10000,6);
int years=0;
while(savings.query()<20000)
{
savings.add_interest();
years++;
}
cout<<"The amount of years is: "< return 0;
}
// file: ACCOUNT.h
// 4/4/2018
//
#ifndef ACCOUNT_H
#define ACCOUNT_H
class Account
{
private:
double balance;
double interest_rate; // for example, interest_rate=6 means 6%
public:
Account();
Account(double amount, double rate);
void deposit(double);
bool withdraw(double); //returns true if enough money, returns false otherwise
double query();
void set_interest_rate(double rate);
double get_interest_rate();
void add_interest();
};
#endif
D CSE 202 Lab 1 C cse.csusb.edu/kaylese202/lab1.htm Apps YouTubeCAS-California Statef Facebao a Amazancom:Online Online C Compile The lowi tho iles ipla Ispe in, and DONOT COPYAND PASTE the following codes each in its o file statu statu talse trn tulark deserspticn include is trwnExplanation / Answer
//Bank.h
#ifndef BANK_H_
#define BANK_H_
# include <string>
# include "ACCOUNT.h"
using namespace std;
class Bank{
private:
Account savings;
Account checking;
public:
Bank();
Bank(double savings_amount, double checking_amount);
void deposit(double amount,string account);
void withdraw(double amount, string account);
void transfer(double amount, string account);
void print_balances();
};
#endif /* BANK_H_ */
//end of Bank.h
// Bank.cpp
# include <iostream>
# include "Bank.h"
Bank::Bank()
{}
Bank::Bank(double savings_amount, double checking_amount)
{
savings.deposit(savings_amount);
checking.deposit(checking_amount);
}
void Bank::deposit(double amount, string account)
{
if(account == "C")
{
checking.deposit(amount);
}else if(account == "S"){
savings.deposit(amount);
}
}
void Bank::withdraw(double amount, string account)
{
if(account == "C")
checking.withdraw(amount);
else if(account == "S")
savings.withdraw(amount);
}
void Bank::transfer(double amount, string account)
{
if(account == "C")
{
if(checking.withdraw(amount))
savings.deposit(amount);
}else if(account == "S")
{
if(savings.withdraw(amount))
checking.deposit(amount);
}
}
void Bank::print_balances()
{
cout<<" Savings Account balance : $"<<savings.query()<<endl;
cout<<" Checking account balance : $"<<checking.query()<<endl;
}
//end of Bank.cpp
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.