Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

using menu prog, if else if, for loop , do while only.... You are hired by a loc

ID: 1811951 • Letter: U

Question




using menu prog, if else if, for loop , do while only....




You are hired by a local bank to produce some Bank Account Management

software for their computers. The program will track the transactions in a bank

account. All bank accounts should start with $500.00 in the account. Your

program should be a menu driven program which does the following:




1. Display the following menu

to the user:




Bank

Account Manager




1.

Make a deposit




2.

Make a withdrawal




3.

Show current balance




4.

Display account report




5.

Print account report




6.

Exit program.




Enter

a choice (1-6):




2. The menu should be looped

until the user chooses to exit the program, and the program should perform one

of the 6 choices based on the user's input at the menu screen. Once the user

finishes with a choice, the menu should be redisplayed prompting the user to

make another choice.




INTPUT VALIDATION: The input to the menu should be validated to make

sure that the user enters a number 1 - 6. If the user enters any other number,

an error message should be displayed and the menu should be redisplayed.




3. OPTION 1: Make a deposit:





a) If the user chooses 1 on the

menu screen, then you should prompt the user to enter a deposit into the

account.




b) The deposit should be added

to the balance in the bank account




c) All deposits should be

stored in an output file called (transaction_list.txt) as a positive number.




4. OPTION 2: Make a

withdrawal:




a) If the user chooses 2 on the

menu screen, then you should prompt the user to enter an amount to withdraw

from the account.




b) The withdrawal amount should

be subtracted from the balance in the bank account.




c) All withdrawals should be

stored in an output file called (transaction_list.txt) as a negative number.




NOTE: The transactions should

appear in the output file in the exact order that the user makes the

transaction. Please see the sample file.




5. OPTION 3: Show current

balance:




a) If the user chooses 3 on the

menu screen, then you should display the current balance that is in the

account.




6. OPTION 4: Display account report:




a) If the user chooses 4 on the

menu screen, then you should display a report about the account which contains

the following information. The report should be displayed on the console.




b) the current balance in the

account.




c) the number of deposits to

the account.




d) the total amount of the

deposits to the account.




e) the average deposit amount.




d) the number of withdrawals

from the account.




f) the total amount of

withdrawals from the account.




g) the average withdrawal from

the account.




7. OPTION 5: Print account

report:




a) If the user chooses 5 on the

menu screen, then you should store all of the information from OPTION 4 in a

file called (bank_account_report.txt);




8. OPTION 6: Exit program:




a) If the user chooses 6 on the

menu screen then the program should exit.

Explanation / Answer

The modified program according to yout need is given below...kindly rate now...

#include<iostream.h>

#include<process.h>

#include<string.h>

int main()

{

FILE *fp;

char ch1;

fp=fopen("bank_account_report.txt","w");

int ch;

float init_bal = 500.0; // initial balance

float amn;

float total=0;

int dep,wit;

float dep_amn=0.0,wit_amn=0.0,avg_dep=0.0,avg_wit=0.0;

cout<<Enter ur choice 1. Make Deposit 2. Make Withdrawl 3. Show Current Balance 4. Display account report 5. Print account report 6. Exit ";

cin>>ch;

void choice()

{

while(ch!=6){ // until user exits

switch(ch)

{

case 1: deposit();

break;

case 2: withdraw();

break;

case 3: show_curr();

break;

case 4: disp_acc();

break;

case 5: print_acc();

break;

default: exit();

}

}}

}

void deposit()

{dep=0; // count deposits

cout<<"enter amount to be deposited";

cin>>amn;

total += init_bal + amn; //balance update

dep++;

dep_amn+=amn; // tracks total deposited amount

cout<<"Total Amount="<<total;

choice(); // displays list again

}

void withdraw()

{

wit=0;

cout<<"enter amount to be withdrawn";

cin>>amn;

if(amn<=total) // condition check

{

total-=amn; // balance deducted

wit++;

wit_amn+=amn;

}

else

{

cout<<"invalid amount..enter again";

withdraw();

}

choice(); // displays list again

}

void show_curr()

{

cout<<"Total Amount="<<total;

choice(); // displays list again

}

void disp_acc()

{

avg_dep= dep_amn/ dep;

avg_wit= wit_amn/ wit;

cout<<"Current Amount: "<<total;

cout<<"Total Deposits: "<< dep;

cout<<"Total Deposit Amount: "<< dep_amn;

cout<<"Average Deposit Amount: "<<avg_dep;

cout<<"Total Withdraws: "<< wit;

cout<<"Total Withdrawn Amount: "<< wit_amn;

cout<<"Average Withdrawn Amount: "<< avg_wit;

choice(); // displays list again

}

void print_acc()

{

putc(("Current Amount: "<<total) ,fp);

putc(("Total Deposits:"<<dep),fp);

putc(("Total Deposit Amount:"<<dep_amn) ,fp);

putc(("Average Deposit Amount:"<<avg_dep) ,fp);

putc(("Total Withdraws:"<<wit) ,fp);

putc(("Total Withdrawn Amount: "<<wit_amn),fp);

putc(("Average Withdrawn Amount:"<<avg_wit),fp);

choice(); // displays list again

}