Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Imagine a tollbooth at a bridge. Cars passing by the booth are expected to pay 30 Rupees toll. Mostly they do, but sometimes a

Imagine a tollbooth at a bridge. Cars passing by the booth are expected to pay 30 Rupees toll. Mostly they do, but sometimes a car goes by without paying. The tollbooth keeps track of the number of cars that have gone by, and of the total amount of money collected. Model this tollbooth in this question, which keep track of total number of cars passed, and total toll collected. Every line of input contains N or P. When P is input, a paying car crosses the tollbooth. When N is input, a Non paying car crosses the tollbooth. The last input is Q, where the program stops. Finally it prints the total number of cars passed, and total toll collected. Input Format For Custom Testing Sample Case 0 Sample Input For Custom Testing Sample Output Total cars passed : Total toll collected : 90 Explanation Four cars passed the tollbooth. 3 cars paid the toll, hence total toll collected is 90 a Pz Po

Step by Step Solution

3.46 Rating (156 Votes )

There are 3 Steps involved in it

Step: 1

include using namespace std int getche class Tollbooth public Tollboothunsigned int 0 double 0 c... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Fundamental Statistics for the Behavioral Sciences

Authors: David C. Howell

8th Edition

1285076915, 978-1285076911

More Books

Students also viewed these Programming questions

Question

Have metrics for the action been established?

Answered: 1 week ago