Answer to Question #269313 in C++ for mno

Question #269313

Using Switch statement, write a program that displays the following menu for the bank operations available to take services from the customer: 

D= Deposit, W= Withdraw T= Transfer

The program inputs the type of service and amount. It finally displays the amount to be transfer/deposit/transfer after applying charges, total remaining balance of customer according to the following criteria:

Deposit = 0.5% charges of deposited amount

Withdraw = 1.5% charges of withdraw amount

Transfer = 2.5% charges of transfer amount


1
Expert's answer
2021-11-20T12:36:21-0500
#include<iostream>
#include<string>
using namespace std;




int main()
{
	char ch=' ';
	double amount;
	double balance=0;
	double charges;
	while(ch!='E' && ch!='e'){


		cout<<"D= Deposit, W= Withdraw T= Transfer E= Exit: ";
		cin>>ch;




		switch(ch){
		case 'D':
		case 'd':{
			//Deposit = 0.5% charges of deposited amount	 
			cout<<"Enter amount to deposit: ";
			cin>>amount;
			charges=amount*(0.5/100.0);
			balance+=(amount-charges);
			cout<<"Charges: "<<charges<<"\n";
			cout<<"Balance: "<<balance<<"\n";
				 }
				 break;
		case 'W':
		case 'w':{
			//Withdraw = 1.5% charges of withdraw amount
			cout<<"Enter amount to withdraw: ";
			cin>>amount;
			charges=amount*(1.5/100.0);
			balance-=(amount+charges);
			cout<<"Charges: "<<charges<<"\n";
			cout<<"Balance: "<<balance<<"\n";


				 }


				 break;
		case 'T':
		case 't':{
			//Transfer = 2.5% charges of transfer amount
			cout<<"Enter amount to transfer: ";
			cin>>amount;
			charges=amount*(2.5/100.0);
			balance-=(amount+charges);
			cout<<"Charges: "<<charges<<"\n";
			cout<<"Balance: "<<balance<<"\n";
				 }
				 break;
		case 'E':
		case 'e':{
			//exit
				 }
				 break;
		default:{


				}
				break;
		}
	}


	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS