|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hey all plzzz help .......
I must write this algorithm in pseudocode but I just can get it, it's an assignment question.
The manager of a speedy bus company needs to know how many people travel by bus to different regions, which have codes A, B and C. Accept the region code and number of passengers for every bus. A region code = Z, indicates the end of the data. Calculate the total number of passengers per region who used the bus during the day, and display the region totals. Also indicate which region had the lowest number of passengers on that day. Draw an IPO chart and write and algorithm in pseudocode to solve this problem. |
|
#2
|
||||
|
||||
|
a loop that accepts user input - stored in array of structs
-region code -number of passenger for the bus -terminated upon entry of 'Z' a loop that moves thru the struct array a switch statement that looks at teh region code and keeps totals for each region *hope that helps ![]() |
|
#3
|
||||
|
||||
|
or even simpler, u can do all the processing in the first loop. depending on the user's input as to which region, add teh number of passengers to an accumlator, and increment teh counter for that acculator
|
|
#4
|
|||
|
|||
|
huh............m8 i'm very new at this a first year student studying correspondence so i know nothing this is all i have
Code:
Amount_of_passengers Display ‘’ Please enter the region code ’’ enter code Display ‘’ Please enter the number of passengers for this region code ‘’ enter amount not much hey.,.,...............i'm a noooooooooob |
|
#5
|
||||
|
||||
|
ok, sorry. lemme try again. the code that you have above, you will want to run that more than one time, yes? so if you create a loop that inputs the code and the amount, and then inside that loop you would look at the code entered, and depending on the code you would want to add teh number of passengers to some variable that is accumulating the number of passengers for each region, yes?
|
|
#6
|
|||
|
|||
|
ja yes that is it..................but it must not use a array, just a ''for'' command, but i'm not sure now to write the command.
for i = ............ |
|
#7
|
|||
|
|||
|
thx for your help so far m8 ......... i really need it
does this look right so far....... Code:
Amount_of_passengers Display ‘’ Please enter the region code – enter Z to terminate the program ’’ enter code do while code not = Z enddo sum = 0 for total = 1 to amount Display ‘’ Please enter the number of passengers for this region code ‘’ enter amount sum = sum + amount my assignment must be in the 25 th and this is all that is holding me back. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Software Design > Hey all plzzz help ....... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|