Question

In: Computer Science

In C++, define the class bankAccount to implement the basic properties of a bank account. An...

In C++, 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 functions
to manipulate an object. Use a static member in the class to
automatically assign account numbers. Also declare an array of 10 components
of type bankAccount to process up to 10 customers and write a
program to illustrate how to use your class.

Solutions

Expert Solution

#include<bits/stdc++.h>
using namespace std;

class bankAccount{
  
   string name;
   int accountNumber;
   string accountType;
   double balance,interest;
  
   public:
   static int account;
   bankAccount(){}
   bankAccount(string n,string t,double b,double i)
   {
       accountNumber=account;
       account++;
       name=n;
       accountType=t;
       balance=b;
       interest=i;
   }
  
   void display()
   {
       cout<<"Account Number: "<<accountNumber<<endl;
       cout<<"Name: "<<name<<endl;
       cout<<"Account Type: "<<accountType<<endl;
       cout<<"Balance: "<<balance<<endl;
       cout<<"Interest: "<<interest<<endl;
       cout<<endl;
   }
  
   void setBalance(double b)
   {
       balance=b;
   }
  
   void setInterest(double i)
   {
       interest=i;
   }
};
int bankAccount::account=1000;

int main()
{
   bankAccount * customer=new bankAccount[10];
  
   //declaring 10 customers
   customer[0]=bankAccount("ABC","SAVINGS",15000,5.2);
   customer[1]=bankAccount("DEF","SAVINGS",5000,4.2);
   customer[2]=bankAccount("GHI","CHECKING",25000,6.2);
   customer[3]=bankAccount("JKL","SAVINGS",50000,8.1);
   customer[4]=bankAccount("MNO","CHECKING",125000,16);
   customer[5]=bankAccount("PQR","SAVINGS",175000,1.3);
   customer[6]=bankAccount("STU","SAVINGS",1000,23.2);
   customer[7]=bankAccount("VWX","CHECKING",200,14.2);
   customer[8]=bankAccount("YZS","CHECKING",25300,3.6);
   customer[9]=bankAccount("CSD","SAVINGS",745000,7.2);
   cout<<"Details of customers are:"<<endl;
   for(int i=0;i<10;i++)
   {
       cout<<"======================================="<<endl;
       customer[i].display();
       cout<<"======================================="<<endl;
   }
   customer[0].setBalance(102354);
   customer[0].setInterest(9.9);
   customer[0].display();
}


Related Solutions

c++ programming 1.1 Class definition Define a class bankAccount to implement the basic properties of a...
c++ programming 1.1 Class definition Define a 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, check/savings/business)  Balance (double)  Interest rate (double) – store interest rate as a decimal number.  Add appropriate member functions to manipulate an object. Use a static member in the class to automatically assign account numbers. 1.2 Implement...
using C++ Please create the class named BankAccount with the following properties below: // The BankAccount...
using C++ Please create the class named BankAccount with the following properties below: // The BankAccount class sets up a clients account (using name & id), and - keeps track of a user's available balance. - how many transactions (deposits and/or withdrawals) are made. public class BankAccount { private int id; private String name private double balance; private int numTransactions; // ** Please define method definitions for Accessors and Mutators functions below for the class private member variables string getName();...
Write a program to create a bank account and to process transactions. Call this class bankAccount...
Write a program to create a bank account and to process transactions. Call this class bankAccount A bank account can only be given an initial balance when it is instantiated. By default, a new bank account should have a balance of 0. A bank account should have a public get method, but no public set method. A bank account should have a process method with a double parameter to perform deposits and withdrawals. A negative parameter represents a withdrawal. It...
In c++, define a class with the name BankAccount and the following members: Data Members: accountBalance:...
In c++, define a class with the name BankAccount and the following members: Data Members: accountBalance: balance held in the account interestRate: annual interest rate. accountID: unique 3 digit account number assigned to each BankAccount object. Use a static data member to generate this unique account number for each BankAccount count: A static data member to track the count of the number of BankAccount objects created. Member Functions void withdraw(double amount): function which withdraws an amount from accountBalance void deposit(double...
c++ The above Account class was created to model a bank account. An account has the...
c++ The above Account class was created to model a bank account. An account has the properties (keep the properties private) account number, balance, and annual interest rate, date created, and functions to deposit and withdraw. Create two derived classes for checking and saving accounts. A checking account has an overdraft limit, but a savings account cannot be overdrawn. Define a constant virtual toString() function in the Account class and override it in the derived classes to return the account...
(In C++) Bank Account Program Create an Account Class Create a Menu Class Create a main()...
(In C++) Bank Account Program Create an Account Class Create a Menu Class Create a main() function to coordinate the execution of the program. We will need methods: Method for Depositing values into the account. What type of method will it be? Method for Withdrawing values from the account. What type of method will it be? Method to output the balance of the account. What type of method will it be? Method that will output all deposits made to the...
Create a class BankAccount to hold at least the following data / information about a bank...
Create a class BankAccount to hold at least the following data / information about a bank account: Account balance Total number of deposits Total number of withdrawals Interest rate e.g., annual rate = 0.05 Service charges per month The class should have the following member functions: Constructor To set the required data. It may be parameterized or user’s input. depositAmount A virtual function used to accept an argument for the amount to be deposited. It should add the argument (amount)...
The Account class Create a class named Account, which has the following private properties:
in java The Account class Create a class named Account, which has the following private properties: number: long balance: double Create a no-argument constructor that sets the number and balance to zero. Create a two-parameter constructor that takes an account number and balance. First, implement getters and setters: getNumber (), getBalance (), setBalan newBalance). There is no setNumber () once an account is created, its account number cannot change. Now implement these methods: void deposit (double amount) and void withdraw (double amount). For both these methods, if the amount is less than...
The Account class Create a class named Account , which has the following private properties:
 The Account class Create a class named Account , which has the following private properties: number: long balance: double Create a no-argument constructor that sets the number and balance to zero. Create a two-parameter constructor that takes an account number and balance. First, implement getters and setters: getNunber(), getBalance(), setBalance (double newBalance) . There is no setNunber() - once an account is created, its account number cannot change. Now implement these methods: void deposit (double anount) and void withdraw(double anount). For both these methods, if the amount is less than zero,...
You are asked to implement a class Pizza, the default values of properties are given as:...
You are asked to implement a class Pizza, the default values of properties are given as: Diameter: 8.0 Name: DefaultName Supplier: DefaultSupplier Hints: A pizza with diameter greater than 15 will be considered as a large pizza. The method IsLargePizza will return a true if the pizza is considered as a large pizza or a false if it is not considered as a large pizza. There are two ToString methods, the one with no parameter passed will return the information...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT