using namespace std;
The class Account {
Public:
The Account (string newId, string newName, double newBalance, double newAnnualInterestRate);
Void setId (string newId) {
Id=newId;
}
Void elegantly-named setName (string newName) {
Name=newName.
}
Void setBalance (double newBalance) {
The balance=newBalance;
}
Void setAnnualInterestRate (double newAnnualInterestRate) {
AnnualInterestRate=newAnnualInterestRate;
}
Const string getId () {
return id;
}
Const string getName () {
return name;
}
Double the getBalance () const {
Return the balance.
}
Double getAnnualInterestRate () const {
Return annualInterestRate;
}
Double withdraw (double money) const {
Return the balance - money;
}
Double deposit (double money) const {
Return the balance + money;
}
Double computeMonthlyInterestRate () const {
Return annualInterestRate/12;
}
Void the print () const;
Private:
String id;
string name;
Double balance;
Double annualInterestRate;
};
Void Account: : print () const {
Cout<& lt;" Account: "& lt;
Int main () {
Account Account (" 112233 ", "zhang", 20000,4.5);
The withdraw (2500);
The deposit (3000);
The print ();
return 0;
}
CodePudding user response:
# include & lt; Iostream>
# include & lt; String>
using namespace std;
The class Account
{
Public:
The Account (string newId, string newName, double newBalance, double newAnnualInterestRate)
{}