Objective: 1. Ability to implement class, and application on it. Question: 1. Cr
ID: 3634795 • Letter: O
Question
Objective:
1. Ability to implement class, and application on it.
Question:
1. Create the following two classes:
A. a class called CustomerBankAccount with the following members:
• 3 private member variables: Name, AccountNumber, Balance.
• 8 public member functions:
a. A default constructor to initialize all member variables of the class
b. A function Set to set the values of the account information (Name,
AccountNumber, and Balance) with valid values.
c. A function Print to print the account information
d. A function GetName to return the Name of the customer
e. A function GetAccountNumber to return the account number of the customer
f. A function GetBalance to return the balance of the customer.
g. A function Deposit to deposit money in the account.
h. A function Withdraw to withdraw money from the account
B. Class called CustomerBankList with the following properties
• Two private members:
1. List[100]: array with type CustomerBankAccount to store the
information of the customers in the bank.
2. NumberOfCustomer: variable of type integer to store the actual
number of the customer in the bank
• 7 public member functions:
a. Default constructor to initialize the NumberOfCustomer to 0
b. A function called InsertCustomer to add a customer to the List, The
function takes one parameter of type CustomerBankAccount and then
inserts it into the list.
c. A function called Print to print out the information of all customers in the
list.
d. A function called SearchByName to search List for a given item, The
function takes one parameter (name of type string) and then prints out all
information of this customer, if the customer is not found the function prints
out “The Customers NOT found”
e. A function called IsFullList to see whether the list is full or not. The
function returns true if the list is full, otherwise the function returns false.
f. A function called IsEmptyList to see whether the list is empty or not.
The function returns true if the list is empty, otherwise the function returns
false.
g. A function called Size to return the number of the customer in the list.
2. Write a program to test your class designed in part (1)
BankAccountType.h
#ifndef CUSTOMER_H
#define CUSTOMER_H
class CustomerBankAccount
{
…
};
#endif
CustomerBankListType.h
#ifndef CUSTOMERLIST_H
#define CUSTOMERLIST_H
class CustomerBankList
{
….
};
#endif
Client.CPP
void main()
{
CustomerBankList CL;
CustomerBankAccount C;
C.Set("Ahmad", 10, 150.5);
CL.InsertCustomer(C);
C.Set("Ali", 11, 1200);
CL.InsertCustomer(C);
C.Set("Mohammed", 12, 500);
CL.InsertCustomer(C);
C.Set("Samer", 13, 700);
CL.InsertCustomer(C);
CL.Print();
cout<<CL.Size()<<endl;
CL.SearchByName("Ali");
}
Explanation / Answer
#include #include using namespace std; class Bank { private: string myname; int number; double changes; double initialbal; double endingbal; public: Bank(string name=" ", int num=0, double c=0, double ibal=0, double ebal=0) { myname = name; number = num; changes = c; initialbal = ibal; endingbal = ebal; } void EnterName(); void ShowName(void ); void EnterNumber(); void ShowNumber(void ); void EnterChanges(); void ShowChanges(void ); void EnternComputeInitialBal(double ); void ComputeEndinglBal(double ); }; void Bank::EnterName() { coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.