#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Behind you
    Posts
    4
    Rep Power
    0

    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. #2
  3. not a fan of fascism (n00b)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Feb 2003
    Location
    ct
    Posts
    2,756
    Rep Power
    95
    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
  4. #3
  5. not a fan of fascism (n00b)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Feb 2003
    Location
    ct
    Posts
    2,756
    Rep Power
    95
    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
  6. #4
  7. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Behind you
    Posts
    4
    Rep Power
    0
    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
  8. #5
  9. not a fan of fascism (n00b)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Feb 2003
    Location
    ct
    Posts
    2,756
    Rep Power
    95
    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?
  10. #6
  11. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Behind you
    Posts
    4
    Rep Power
    0
    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 = ............
  12. #7
  13. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2003
    Location
    Behind you
    Posts
    4
    Rep Power
    0
    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.

IMN logo majestic logo threadwatch logo seochat tools logo