HOMEWORK 2: Due Tuesday, February 21 midnight (Tue/Wed) COMP 2810: HOMEWORK 1 Due Mon Sep 6 by 11:59 pm Warm-up Programming Exercise in C XXXXXXXXXXpoints) If your program does not compile, or you...

1 answer below »
I just need it edited


HOMEWORK 2: Due Tuesday, February 21 midnight (Tue/Wed) COMP 2810: HOMEWORK 1 Due Mon Sep 6 by 11:59 pm Warm-up Programming Exercise in C++ (100 points) If your program does not compile, or you cannot explain your code satisfactorily, you will lose all or a huge chunk of the points. The purpose of this homework is to help you re-acquaint yourself with programming in C++. If you put in the time and effort to get this program working, you will save a lot of time in later homeworks. Implement the member functions of a class CheckingAccount that simulates your bank checking account. Also implement the corresponding driver (main) program. The CheckingAccount class will have the following member variables: name of account holder, account number and balance. The name of the account holder and opening balance will be input by the user when the checking account is opened at the start of your program. You will assign a random number as the account number. Note: the account number should not remain the same across multiple runs of your program. The user must be prompted to choose from the following list of transactions: (1) Teller Deposit (2) ATM withdrawal (3) Process check (4) Quit For the first 2 transactions, the user must be prompted to enter the amount. Process check could either be for depositing or withdrawing money. For this transaction, the user must be prompted to enter the check number, whether deposit or withdrawal, and amount. Each of the first 3 transactions must correspond to appropriate member functions of the CheckingAccount class. An ATM withdrawal incurs a surcharge of $1.50/=. In addition, the user must be allowed the option of overdraft protection where the user can specify the amount of overdraft protection (s)he needs. Your output will be the equivalent of the bank monthly statement written to a file called “bank_statement” which lists the account holder’s name, number and the opening balance, followed by a line for each transaction indicating the transaction type, amount, check number if applicable plus the balance at the end of that transaction. In case of insufficient funds, appropriate error messages must be displayed only on screen (not in the output file), that transaction cancelled and the user allowed to continue. Note that writing to the output file should not be a part of your CheckingAccount class; instead it should be done in the main program. #include using namespace std; class CheckingAccount { private: string accountName; int accountNum; double accountBal; double amount; public: void getinfo(){ cout < "please="" enter="" your="" name:="" "="">< endl;="" cin="">> accountName; srand(time(0)); accountNum = rand() % 10000; cout < accountnum="">< endl;="" cout="">< "please="" enter="" your="" balance:="" "="">< endl;="" cin="">> accountBal; cout < "your="" balance="" is:="" $"="">< accountbal="">< endl;="" }="" void="" accountinfo()="" {="" cout="">< "name:"="">< accountname="">< endl;="" cout="">< "account="" no:"="">< accountnum="">< endl;="" cout="">< "checking="" account"="">< endl;="" cout="">< "balance:="" $"="">< accountbal="">< endl;="" }="" void="" deposit()="" {="" cout="">< "enter="" the="" amount="" being="" deposited:="" "="">< endl;="" cin="">> amount; accountBal += amount; cout < "your="" amount="" is="" now:="" $"="">< accountbal="">< endl;="" }="" void="" processcheck(){="" int="" checknum;="" double="" w,="" d;="" char="" question;="" cout="">< "please="" enter="" check="" number"="">< endl;="" cin="">> checkNum; cout < "would="" you="" like="" to="" deposit="" or="" withdraw?="" please="" enter="" 'a'="" for="" deposit="" or="" 'b'="" for="" withdraw"="">< endl;="" cin="">> question; if(question == 'a'){ cout < "how="" much="" would="" you="" like="" to="" depsoit?"="">< endl;="" cin="">> d; accountBal += d; cout < "your="" amount="" is="" now:="" $"="">< accountbal="">< endl;="" }="" if(question="=" 'b'){="" cout="">< "how="" much="" would="" you="" like="" to="" withdraw??"="">< endl;="" cin="">> w; if(w > accountBal){ cout < "you="" do="" not="" have="" enough="" to="" process="" this="" check!"="">< endl;="" }="" else{="" accountbal="" -="w;" cout="">< "your="" amount="" is="" now:="" $"="">< accountbal="">< endl;="" }="" }="" else{="" cout=""><"sorry this="" is="" a="" wrong="" input.="" please="" try="" again."="">< endl;="" }="" }="" void="" withdraw()="" {="" double="" w;="" char="" proceed;="" double="" protection;="" double="" surcharge="1.50;" cout="">< "please="" enter="" the="" amount="" you="" wish="" to="" withdraw:="" "="">< endl;="" cin="">> w; if( w > accountBal){ while(proceed != 'y' || proceed != 'n'){ cout <"your balance="" is="" less="" than="" what="" you="" are="" trying="" to="" withdraw!="" continuing="" will="" ask="" for="" a="" small="" overdraft="" protection.="" continue?="" please="" enter="" y="" or="" n."="">< endl;="" cin="">> proceed; if(proceed == 'y'){ cout <"how much="" protection="" would="" you="" like?="" remember,="" you="" will="" have="" to="" pay="" this="" protection="" back="" to="" the="">< endl;="" cin="">> protection; w += surcharge; w -= protection; cout <"you asked="" for:="" "="">< protection="">< "="" in="" protection"="">< endl;="" accountbal="accountBal" -="" w;="" cout="">< "your="" amount="" is="" now:="" $"="">< accountbal="">< endl;="" break;="" }="" if(proceed="='n'){" cout="">< "your="" amount="" is="" is="" now:="" $"="">< accountbal="">< endl; break; } else{ endl;="" break;="" }="">
Answered Same DayDec 03, 2021

Answer To: HOMEWORK 2: Due Tuesday, February 21 midnight (Tue/Wed) COMP 2810: HOMEWORK 1 Due Mon Sep 6 by 11:59...

Ximi answered on Dec 03 2021
121 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here