Anda di halaman 1dari 2

Car speeds program

Task1
A data logger is used to record car speeds outside a primary school.
Each morning the speed of 1 car is measured as it passes the school. At the end of the
school day, in the afternoon, the speed of 1 car is measured as it passes the school.
Both speeds are recorded in a program for analysis.
Your program will:

 Prompt the user to enter the recorded speeds for AM and PM over a period of 30
days

 Store the speeds in two one-dimensional arrays, one for the start of day and one for
the end of the day.

All speeds must be validated on entry and any invalid speeds rejected. You must
decide upon your own validation rules.

Task2
Calculate the average speed for the start of the day and the average speed for the end
of the day. Output these with averages with a suitable message for each one.

Task3
Select the day with the highest car speed for the beginning of the day and day with the
lowest car speeds at the end of the day. Output these days with the corresponding
days.
Your program must include:
 appropriate prompts for the entry of data
 error messages where necessary
 clear and understandable output
 suitable names for identifiers and comments
Example1 Pseudocode Student Exercise
Tickets are sold for a concert at $20 each. If 10 tickets are bought then the discount is
10%; if 20 tickets are bought the discount is 20%. No more than 25 tickets can be
bought in a single transaction.
a Use pseudocode to write an algorithm to calculate the cost of buying a given
number of tickets.
Pseudcode past paper questions
0420_w11_qp_12_ExamStyle_PseudoCodeQuestion.pdf
0420_s11_qp_11_ExamStyle_PseudoCode.pdf
Pseudo code exam style question 4.pdf

Example2 Pseudocode Student


A school with 600 students wants to produce some information from the results of the
four standard tests in Maths, Science, English and IT. Each test is out of 100 marks.
The information output should be the highest, lowest and average mark for each test
and the highest, lowest and average mark overall. All the marks need to be input.

a Use pseudocode to write an algorithm to complete this task.


b Explain how you would test your algorithm.

Create a Flow chart for the algorithm below


Task 1
A town contains 5000 houses. Each house owner must pay tax based on the value of the house. Houses over $200 000
pay 2% of their value in tax, houses over $100 000 pay 1.5% of their value in tax and houses over $50 000 pay 1% of their
value in tax. All others pay no tax. Write an algorithm to solve this problem in the form of a flowchart.

Anda mungkin juga menyukai