Question

In this, you will create a bank account management system according to the following specifications: BankAccount...

In this, you will create a bank account management system according to the following specifications:

BankAccount Abstract Class contains the following constructors and functions: BankAccount(name, balance): a constructor that creates a new account with a name and starting balance.

getBalance(): a function that returns the balance of a specific account.

deposit(amount): abstract function to be implemented in both Checking and SavingAccount classes.

withdraw(amount): abstract function to be implemented in both Checking and SavingAccount classes.

messageTo Client (message): used to print a specific message to a client.

CheckingAccount Class: A class that implements the Abstract Class BankAccount and implements both deposit () and withdraw ().
Deposit process in checking account has some constrains. Client can deposit any amount using checks and limit of $10,000.00 of cash deposit.

Client can withdraw any amount he wants.

SavingAccount Class: A class that inherits from the Class CheckingAccount and implements both deposit () and withdraw ().
A client can deposit any amount using checks and a limit of $5,000.00 of cash deposit. A 5% interest should be calculated on the total.

Client can only withdraw 20% of the total balance in each session.

Main class: this class is to test your code. The test should be done by creating an array of type BankAccount that stores different bank accounts types for different clients and perform some processing by calling the implemented methods on these accounts.

PLEASE ANSWER THIS IN C++!! I NEED HELP WITH THIS AND DON'T UNDERSTAND WHERE TO START!! WHOEVER ANSWERS THIS THANK YOU!!!

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include <iostream>
using namespace std;

class BankAccount
{

private:
string name;
double balance;

public:
BankAccount(string name, double balance)
{
   this->name = name;
   this->balance = balance;
}

double getBalance()
{
   return balance;
}
string getName()
{
   return name;
}

virtual void deposit(double amount)
{
  
}

virtual void withdraw(double amount)
{
  
}

void messageToClient(string message)
{
   cout<<message;
}
  
};

class CheckingAccount: public BankAccount
{
   public:
   CheckingAccount(string name, double balance): BankAccount(name,balance){}
  
   void deposit(double amount)
   {
   double bal = getBalance();
      
   if(amount <= 10000)
   {
   bal = bal + amount;
  
   cout<<"Balance : "<<bal;
   messageToClient(" amount deposited ");
   }
   else
   messageToClient(" amount not deposited ");
   }
  

   void withdraw(double amount)
   {
   double bal = getBalance();
   bal = bal - amount;
  
   cout<<"Balance : "<<bal;
   messageToClient(" amount withdrawn ");
   }
  
  
};


class SavingAccount : public BankAccount
{
   public:
   SavingAccount(string name, double balance): BankAccount(name,balance)
   {
      
   }
   void deposit(double amount)
   {
   double balance = getBalance();
      
   if(amount <= 5000)
   {
  
   balance = balance + amount + 0.05*(balance+amount);
   messageToClient(" amount deposited ");
   cout<<"Balance : "<<balance;
   }
   }

   void withdraw(double amount)
   {
   double balance = getBalance();
   if(amount <= 0.2*balance)
   balance = balance - amount;
   messageToClient(" amount withdrawn ");
   cout<<"Balance : "<<balance;
   }
  

};


int main()
{
BankAccount *ba[2];

ba[0] = new CheckingAccount("John Adams",3455.00);
cout<<ba[0]->getName()<<endl;
ba[0]->deposit(345.00);
cout<<endl;
ba[0]->withdraw(120.00);
cout<<endl;
cout<<ba[0]->getBalance()<<endl;

ba[1] = new SavingAccount("Caterine James",2300.00);
cout<<ba[1]->getName()<<endl;
ba[1]->deposit(345.00);
cout<<endl;
ba[1]->withdraw(120.00);
cout<<endl;
cout<<ba[1]->getBalance()<<endl;


  
       return 0;

}

Output:

John Adams
Balance : 3800 amount deposited 
Balance : 3335 amount withdrawn 
3455
Caterine James
 amount deposited Balance : 2777.25
 amount withdrawn Balance : 2180
2300

Do ask if any doubt. Please up-vote.

Add a comment
Know the answer?
Add Answer to:
In this, you will create a bank account management system according to the following specifications: BankAccount...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • TASK 1 Create a new class called CheckingAccount that extends BankAccount. It should contain a static...

    TASK 1 Create a new class called CheckingAccount that extends BankAccount. It should contain a static constant FEE that represents the cost of clearing onecheck. Set it equal to 15 cents. Write a constructor that takes a name and an initial amount as parameters. Itshould call the constructor for the superclass. It should initializeaccountNumber to be the current value in accountNumber concatenatedwith -10 (All checking accounts at this bank are identified by the extension -10). There can be only one...

  • Requirements:  Your Java class names must follow the names specified above. Note that they are...

    Requirements:  Your Java class names must follow the names specified above. Note that they are case sensitive. See our template below.  BankAccount: an abstract class.  SavingAccount: a concrete class that extends BankAccount. o The constructor takes client's firstname, lastname and social security number. o The constructor should generate a random 6-digit number as the user account number. o The initial balance is 0 and the annual interest rate is fixed at 1.0% (0.01).o The withdraw method signature...

  • Design a class named BankAccount containing the following data field and methods. • One double data...

    Design a class named BankAccount containing the following data field and methods. • One double data field named balance with default values 0.0 to denote the balance of the account. • A no-arg constructor that creates a default bank account. • A constructor that creates a bank account with the specified balance.  throw an IllegalArgumentException when constructing an account with a negative balance • The accessor method for the data field. • A method named deposit(double amount) that deposits...

  • c++ please    Define the class bankAccount to implement the basic properties of a bank account....

    c++ please    Define the class bankAccount to implement the basic properties of a bank account. An object of this class should store the following data: Account holder’s name (string), account number (int), account type (string, checking/saving), balance (double), and interest rate (double). (Store interest rate as a decimal number.) Add appropriate member func- tions to manipulate an object. Use a static member in the class to automatically assign account numbers. Also declare an array of 10 compo- nents of...

  • According to the following information, define Account, CheckingAccount, and TestPart1 classes. 1. Account and CheckingAccount classes...

    According to the following information, define Account, CheckingAccount, and TestPart1 classes. 1. Account and CheckingAccount classes Account - number: int - openDate: String - name: String - balance: double + Account(int, String, String, double) + deposit(double): void + withdraw (double): boolean + transferTo(Account, double): int + toString(): String CheckingAccount + CheckingAccount(int, String, String, double) + transferTo(Account, double): int Given the above UML diagam, define Account and CheckingAccount classes as follow: Account (8 points) • public Account(int nu, String op, String...

  • Java - In NetBeans IDE: •Design an abstract class called BankAccount which stores the balance. –Implement...

    Java - In NetBeans IDE: •Design an abstract class called BankAccount which stores the balance. –Implement a constructor that takes the balance (float). –Provide abstract methods deposit(amount) and withdraw(amount) •Design a class called SavingsAccount which extends BankAccount. –Implement a constructor that takes the balance as input. –It should store a boolean flag active. If the balance at any point falls below $25, it sets the active flag to false. It should NOT allow the balance to fall below $0. –If...

  • C++ Design a class bankAccount that defines a bank account as an ADT and implements the...

    C++ Design a class bankAccount that defines a bank account as an ADT and implements the basic properties of a bank account. The program will be an interactive, menu-driven program. a. Each object of the class bankAccount will hold the following information about an account: account holder’s name account number balance interest rate The data members MUST be private. Create an array of the bankAccount class that can hold up to 20 class objects. b. Include the member functions to...

  • [JAVA] < Instruction> You are given two classes, BankAccount and ManageAccounts ManageAccounts is called a Driver...

    [JAVA] < Instruction> You are given two classes, BankAccount and ManageAccounts ManageAccounts is called a Driver class that uses BankAccount. associate a member to BankAcount that shows the Date and Time that Accounts is created. You may use a class Date. To find API on class Date, search for Date.java. Make sure to include date information to the method toString(). you must follow the instruction and Upload two java files. BankAccount.java and ManageAccounts.java. -------------------------------------------------------------------------- A Bank Account Class File Account.java...

  • *Step1: -Create UML of data type classes: reuse from lab3 for class Account, CheckingAccount and SavingAccount...

    *Step1: -Create UML of data type classes: reuse from lab3 for class Account, CheckingAccount and SavingAccount -Read the requirement of each part; write the pseudo-code in a word document by listing the step by step what you suppose to do in main() and then save it with the name as Lab4_pseudoCode_yourLastName *Step2: -start editor eClipse, create the project→project name: FA2019_LAB4PART1_yourLastName(part1) OR FA2019_LAB4PART2_yourLastName (part2) -add data type classes (You can use these classes from lab3) Account_yourLastName.java CheckingAccount_yourLastName.java SavingAccount_yourLastName.java -Add data structure...

  • Write a Java class called BankAccount (Parts of the code is given below), which has two...

    Write a Java class called BankAccount (Parts of the code is given below), which has two fields name (String) and balance (double), two constructors and five methods getName(), getBalance(), deposit (double amount), withdraw(double amount) and toString(). The first constructor should initialize name to null and balance to 0. The second constructor initializes name and balance to the parameters passed. deposit method deposits the amount to the account causing the current balance to increase, withdraw method withdraws the amount causing the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT