#include <iostream>
#include <string>
#include <iomanip>
usingnamespace std;
//void deposit(double); // don't need this declaration and is causing the error
class BankAccount
{
private:
int ActNum;
string LastName;
string FirstName;
double balance;
public:
BankAccount()
{
ActNum = 0;
balance = 0.0;
}
BankAccount(int act, string first, string last, double bal)
{
ActNum = act;
FirstName = first;
LastName = last;
balance = bal;
}
void setLastName(string last)
{
LastName = last;
}
int getActNum()
{
return ActNum;
}
string getFirstName()
{
return FirstName;
}
string getLastName()
{
return LastName;
}
double getbalance()
{
return balance;
}
void print()
{
cout<<fixed<<showpoint<<setprecision(2);
cout<<"Account Number: "<<ActNum<<endl;
cout<<"Name: "<<FirstName<<' '<<LastName<<endl;
cout<<"Current Balance: $"<<balance<<endl;
}
void deposit(double money)
{
balance = balance + money; // can also do balance += money;
}
};
int main()
{
BankAccount one(5623, "Jim", "Jones", 100.89);
one.print();
//double balance = 0.0; // don't need this
double money = 0.0;
cout<<"enter amount of deposit: ";
cin>>money;
one.deposit(money); // add class object to front
//cout<<"Your new balance is: $"; // don't need this for the example
one.print(); // print out new balance
return 0;
}
Account Number: 5623
Name: Jim Jones
Current Balance: $100.89
enter amount of deposit: 100.00
Account Number: 5623
Name: Jim Jones
Current Balance: $200.89