Question
i am beginner of Object Oriented Programming. code in C++ language each line of code comment and explain. code in visual studio 2013 and 2019.
i am beginner of Object Oriented Programming.
code in C++ language each line of code comment and explain.
code in visual studio 2013 and 2019.
use charcter array .strickly not use string.
source code of program
only use this header (#include
note: i am ask this question many time but not provide the best code.so plz provide the best code.
output code of screen shot send plz.
task:Create a class ATM with following data members and methods:
int totalCash
default parameterized constructor
void setCash(int)
int getCash()
void showBalance() //do not change the name of function.
Derive a class Transaction from ATM with the following data members:
A dynamic array of AccountHoler class
char *AccountHolderarr
int size
default parameterized constructor, it should receive the size of array otherwise assign the value 0 to size. Declare a dynamic array inside the constructor and initialize the values with 0.
void withdraw Amount function. This function should receive the account number and withdrawal amount from main function.
1. Check that whether the account number is valid or invalid
2. Check that whether the balance in the user's account is sufficient enough for this transaction.
3. Check that whether the balance in the ATM is sufficient enough for this transaction.
4. update the totalCash of ATM and balance of the account holder after this transaction
void setData function. This should receive the index value, account number, and balance. If the index is in the given range and account number is valid than update balance in the account of that particular account holder. if the index value is out of bound than report the message Invalid index. If account number doesnt exist than display the message invalid account number.
void showBalance function. This function should display the balance of all the account holders on console
void resize function. This function should receive the size as a parameter.
Update the previous value of size with the current value.
Create a new array with the updated size.
Copy the contents of previous array in this new array.
If the size of newly created array is greater than previous array than initialize the remaining indices with 0.
Delete the previous array and store the address of newly created array in arr.
Create a class AccountHolder with the following data members and methods:
int Account Number
int balance
default parameterized constructor.
setAccountNumber
setBalance function
getAccountNumber
getBalance
Inside main function
transaction t1(3, 5000); //3 is the size of array and 5000 is ATM cash
int choice;
do{
showMenu();
cout << Enter your choice;
cin >> choice:
switch(choice){
case 1:
case 2:}
}while(choice!=0);
Display the following menu inside showMenu function. You can change the numbering against the operations, but it is mandatory to handle all the cases.
Enter 1 to insert a record// for set data function
Enter 2 to update ATM cash//
Enter 3 to update account holders balance// this should handle the case of cash deposit.
Enter 4 to view ATM cash//
Enter 5 to view account holders balance
Enter 6 to resize the array
Enter 7 to withdraw amount from the account
Enter 0 to terminate the program
// sample of code use in code for help AccountHolder(char*arr1) { int size = getlength(arr1); freememory(arr); arr = new char[size + 1]; copyarr(arr, arr1); name[size] = '\0'; }
void copyarr(char*& dest, const char* src) { for (int i = 0; src[i] != '\0'; i++) { dest[i] = src[i]; } } int getlength(char* arr1) { int count = 0; for (int i = 0; arr1[i] != '\0'; i++) { count++; } return count; }
void freememory(char* arr) { delete[] arr; arr = nullptr; }
output code of screen shot send plz.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started