Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a class Account to manage a bank account. Each account should have an acco

ID: 3622901 • Letter: W

Question

Write a class Account to manage a bank account. Each account should have an account number (an int). One should be able to make deposits and withdrawals and read out the balance. The balance should be stored in a private data member of type float. Account should have the following member functions:

* void Account::withdraw(float const &amount); //Take from account
* void Account::deposit(float const &amount); // Put into account
* float Account::balance(); //Return the balance

Make sure that the Account constructor initializes the balance to zero.

Secondly, modify the Account class so that it writes a record of every transaction into a file. All accounts present in a program should use the same file.

Write a derived class DepositAccount that inherits from the Account class. The account should pay interest at an annual rate that is private member data, but impose a fee of $5 for every withdrawal.

Derive a class CreditAccount from Account which allows the account to have a negative balance. The maximum credit line should be stored in a private data member. Write member functions to read out and change the credit line. The credit line may not be changed in such a way that the current balance is less than the credit line.

I need to be using Eclipse for writing the code. So please use Eclipse format for the answer. I have completed the first part of the question. I am stuck with second part, where I should write the transactions to a file. I don't know how to figure this out.
I also don't know how to complete the third and the fourth part with inheritance... By the way, I am still really new to this stuff. I would appreciate any help..

Here is what I have written so far (the first part of the question)

class Account
{
public:
float balance();
void withdraw(float const &);
void deposit(float const &);
Account(int acc_num);
private:
int acc_no;
float account_balance;
};

Account::Account(int acc_num):acc_no(acc_num){
account_balance=0.0;
}

float Account::balance(){
return accoount_balance;
}

void Account::withdraw(float const &amount)
{
if (amount>0 && amount<=account_balance) {
std::cout<< "withdrawn " << amount << " Euros.";
account_balance = account_balance - amount;}
else
std::cout<< "Error!";
}

void Account::deposit(float const &amount)
{
if (amount>=0) {
std::cout << "deposited "<< amount << " Euros. ";
account_balance = account_balance + amount;}

else
std::cout << "Error!";
}

Explanation / Answer

Dear, Code writes the data to file #include #include using namespace std; class Account { public: float balance(); void withdraw(float const &); void deposit(float const &); Account(int acc_num); private: int acc_no; float account_balance; }; Account::Account(int acc_num):acc_no(acc_num){ account_balance=0.0; } float Account::balance() { return account_balance; } void Account::withdraw(float const &amount) { if (amount>0 && amount
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote