Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A nonstop train runs from Thisland to Thatland with adult and child passengers in several (N) cars. The number of passenger cars (N) should be

A nonstop train runs from Thisland to Thatland with adult and child passengers in several (N) cars. The number of passenger cars (N) should be obtained as input. For each car, print the car number (starting at car 1) and obtain, as input, the number of adult passengers and the number of child passengers in the car. Calculate and print, with appropriate labels the total number of passengers on the train. In addition, calculate and print, with appropriate labels, the percentage of the revenue from adult tickets and the percentage of the revenue from child tickets. Assume that a childs ticket costs $120.50 and an adults ticket costs $320.00. Use python to solve the problem.

Sample input and output for 3 passenger cars is as follows:

Enter the number of passenger cars on the train: 3 For Car 1 
 Enter the number of adults in the car: 3 
 Enter the number of children in the car: 2 For Car 2 
 Enter the number of adults in the car: 5 
 Enter the number of children in the car: 1 For Car 3 
 Enter the number of adults in the car: 8 Enter the number of children in the car: 0 
The total number of passengers on the train is 19 The percentage of the revenue from adult tickets is 93.41%. The percentage of the revenue from child tickets is 6.59%. 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions