Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program to keep track of the passengers in a bus. The maximum passenger capacity of the bus is 3 theta. The bus starts

image text in transcribed
Write a program to keep track of the passengers in a bus. The maximum passenger capacity of the bus is 3 theta. The bus starts at station theta with some initial number of passenger (a random number generated less than or equalt to 3 theta). At each station (1 or more) some passengers arrive and some passengers depart (leave) the bus. Once the input obtained from the user each station, the checks whether the input is correct. If the If the input is correct, it calculates the total number passengers remaining on bus after each station. If at any station the number of passengers exceed 3theta or fall below theta, then displays an error message. Specifically, write the following functions: void inNout (int in[], int out[], int size): The function asks the user to input the number of passengers arriving and leaving at each stations using the keyboard. The parameter in will contain the number of arrivals, out will contain the number of departees, and size is number of stations. bool check InBus(int in[], int out[], int inBus[], int size) The function calculates the number of passengers in the bus after every station and populates the third array parameter of this function. If the number of passengers after any stations exceeds 3theta or becomes less than theta, then it displays a message (shown below) and returns false; The parameter in contains number the number of arrivals, out contains the number of departees, inBus will contain the number of passengers left in the bus, and size the is the number of stations. void printList (int in[], out[], int inBus[], int size): This function prints the number of arriving, leaving and passengers in the bust after each station only if the number of arrivals, out contains the number of departees, inBus contains the number of passengers left in the bus, and size is the number of stations

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

Database Design Using Entity Relationship Diagrams

Authors: Sikha Saha Bagui, Richard Walsh Earp

3rd Edition

103201718X, 978-1032017181

More Books

Students also viewed these Databases questions

Question

Describe the new structures for the HRM function. page 724

Answered: 1 week ago