Answer to Question #265198 in C++ for DANISH

Question #265198

Write a program which calculates the monthly Budget of a person. The program will read the


monthly salary of the person. Then give following options:



Press 1 to calculate gas bill charges


Press 2 to calculate electricity bill charges


Press 3 to calculate fueling charges.


Press 4 to calculate house rent charges




His monthly gas bill charges are 10% of his salary, electricity bill charges are 5% of his salary. His monthly


fueling charges are 10% of his salary, and his house rent charges are 15 %. Your program will calculate and


display the corresponding charges based on the selection (1, 2, 3, or 4)


1
Expert's answer
2021-11-12T17:28:58-0500
#include<iostream>
using namespace std;
int main(){
	cout<<"Press 1 to calculate gas bill charges\nPress 2 to calculate electricity bill charges\n";
	cout<<"Press 3 to calculate fueling charges.\nPress 4 to calculate house rent charges\n";
	int n;
	cin>>n;
	cout<<"Enter your monthly salary\n";
	float sal ;
	cin>>sal;
	switch(n){
		case 1:
			cout<<"Gas bill charges are   "<<sal * 0.1<<endl;
			break;
		case 2:
			cout<<" Electricity bill charges are "<<sal * 0.05<<endl;
			break;
		case 3:
			cout<<" Fueling charges are  "<<sal * 0.1<<endl;
			break;
		case 4:
			cout<<"House rent charges are  "<<sal * 0.15<<endl;
			break;
			
	}
}

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