Course Content
Computer Science 2010 : Olevel : Free Trail Course

Motorway police want you to record the speed of 50 cars at the start of the day and will charge 500 rupees to each car if it crosses the limit of 120. If its speed is less than or equal to 120, the system would display a message indicating normal speed. At the end, it should output the total fine collected and the total number of cars for whom the fine was collected.

Pseudocode:

  • DECLARE SPEED : INTEGER
  • CONSTANT FINE : INTEGER ← 500
  • DECLARE CAR : INTEGER
  • DECLARE TOTALFINE : INTEGER
  • DECLARE X : INTEGER ←1
  • REPEAT 
    • OUTPUT “ENTER CAR SPEED”
    • INPUT SPEED
    • IF SPEED > 120
    • THEN
      • OUTPUT “CHALLAN ISSUED”
      • TOTALFINE ← TOTALFINE + FINE
    • CAR ← CAR + 1
    • ELSE
      • OUTPUT “ NORMALSPEED”
    • ENDIF
  • X←X+1
  • UNTIL X = 51
  • OUTPUT “TOTAL FINE COLLECTED : ”, TOTALFINE
  • OUTPUT “TOTAL CARS: “, CAR