Answer to Question #343965 in C++ for Ali

Question #343965

After the success of Doctor Strange in the Multiverse of Madness UCP movie club decided to display this movie on a bigger screen in UCP auditorium. But you have to buy a ticket for the show. Following are the rates of tickets:

Type of Ticket (1, 2, 3) Price Tax

Student= 100 and 17%tax

Faculty= 200 and 17%tax

Staff= 150 and 17%tax

Write a C++ program in which, ask user about how many tickets they want to buy? And which type of ticket they want to buy. Calculate total bill and display it on console.



1
Expert's answer
2022-05-23T10:19:25-0400
#include <iostream>


int main()
{
	int n, type;
	std::cout << "How many tickets they want to buy: ";
	std::cin >> n;
	std::cout << "Which type of ticket (1,2 or 3): ";
	std::cin >> type;

	double price = 0;
	if (type == 1)
	{
		price = 100 + 100 * 0.17; //price with tax
	}
	else if (type == 2)
	{
		price = 200 + 200 * 0.17; //price with tax
	}
	else if (type == 3)
	{
		price = 150 + 150 * 0.17; //price with tax
	}
	
	if (price != 0)
	{
		std::cout << "Total bill: " << n * price << std::endl;
	}
	else
	{
		std::cout << "Wrong type" << std::endl;
	}

	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