Home > Back-end >  A lot of not just learning c, the following is wrong?
A lot of not just learning c, the following is wrong?

Time:10-09

#include
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; Cout<& lt;" Customer name: "& lt; Cout<& lt;" Account balance: "& lt; Cout<& lt;" Interest: "& 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)
{}
  • Related