Answer to Question #262913 in C++ for Fiona

Question #262913

1.     Make a program that will input type of accommodation room. A-for first class, B-for second class. Charge as follows : first class=800.00 and second class = 650.00. Your program will be terminated if you input C in the accommodation room type.


1
Expert's answer
2021-11-08T11:29:08-0500
#include<iostream>
using namespace std;
int main()
{
	char option;
	cout<<"TYPES OF ACCOMODATION ROOMS";
	cout<<"Select from the list below to see corresponding charges ";
	cout<<"1. Type A - First class \n 2. Type B - Second class ";
	cout<<"Choose your option:";
	cin>>option;
	
	if(option == 'C')
	{
		cout<<"Program terminated";
	}
	else
	{
	  switch(option){
		case 'A':
			cout<<"Charges = 800.00";
			break; 
			case 'B':
			cout<<"Charges = 650.00";
			break; 
			default:
			cout<<"Invalid option, try again with A or B ";
	}
		
	}
	
	
}

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