The local high school uses buses to transport students to school. There are six bus routes labelled
Question:
The local high school uses buses to transport students to school. There are six bus routes labelled A to F. You have
conducted a survey to analyse the punctuality statistics of these buses over a four-week period. The data from the
survey are shown in the table:
Punctuality table
Day Bus A Bus B Bus C Bus D Bus E Bus F
Mon1 0 0 2 1 −1 0
Tue1 0 1 0 0 −1 −5
Wed1 0 0 −1 0 −1 −5
Thu1 2 0 −1 0 −2 −5
Fri1 2 1 −2 0 −4 −4
Mon2 4 2 −2 0 −10 −3
Tue2 0 0 −3 0 −2 −5
Wed2 3 0 −1 0 0 0
Thu2 4 0 0 0 0 0
Fri2 −2 0 0 0 0 0
Mon3 −5 1 −2 2 0 0
Tue3 0 0 0 0 1 −2
Wed3 0 0 1 0 2 −3
Thu3 3 0 1 0 −3 1
Fri3 4 2 1 0 1 1
Mon4 −1 0 1 0 1 1
Tue4 8 0 −1 0 3 0
Wed4 1 1 −1 0 −1 0
Thu4 1 0 2 0 0 −2
Fri4 −2 0 −2 0 0 −5
Positive numbers represent minutes early, negative numbers represent minutes late and 0 represents the bus having
been on time.
Write and test a program or programs for the local high school.
• Your program or programs must include appropriate prompts for the entry of data; data must be validated on
entry.
• Error messages and other output need to be set out clearly and understandably.
• All variables, constants and other identifiers must have meaningful names.
You will need to complete these three tasks. Each task must be fully tested.
Task 1 - Setting up the data storage.
Using arrays set up a system to enable data for each bus route to be entered covering each day of a four-week
period. It must be possible to enter the data supplied or your own set of data, using suitable prompts as necessary.
Task 2 - Working out the statistics.
Extend your program so that the following statistics for the four-week period may be calculated and output:
• the number of late arrivals for each bus route
• the average number of minutes late for each bus route
• the bus route with the highest number of days on which it was late
• the average number of minutes late for each bus route, using only data from days on which it was late
All the results should be displayed with appropriate annotation.
Task 3 - Checking specific days.
Extend the program as follows:
• Allow the user to input a specific day, for example Fri3, to be used for analysis of data.
• Find and display how many buses were late on this particular day.
• For each late bus, display the route label and how late the bus was on this particular day.
1 (a) All variables, constants and other identifiers must have meaningful names. (i) State one array you used for Task 1. State the data type and purpose of this array. Array .................................................................................................................................. Data type ........................................................................................................................... Purpose ............................................................................................................................. ........................................................................................................................................... ........................................................................................................................................... [3] (ii) State one variable you used for Task 2 and one variable you used for Task 3. In each case, state the data type and purpose of the variable. Task 2 variable name ........................................................................................................ Data type ........................................................................................................................... Purpose ............................................................................................................................. ........................................................................................................................................... ........................................................................................................................................... Task 3 variable name ........................................................................................................ Data type ........................................................................................................................... Purpose .............................................................................................................................
(b) Write an algorithm to show how you calculated and output the number of late arrivals and the average number of minutes late for each bus route (part of Task 2), using either pseudocode, programming statements or a flowchart.
(c) Explain how your program uses the input in Task 3 to only find the data for that specific day (part of Task 3). Any programming statements used in your answer must be fully explained. ...................................................................................................................................................
d) Explain how you would alter your program in Task 1 to allow you to choose the number of weeks to enter data on bus arrival times. ................................................................
2 Describe each of the following data types used in programming. In each case, give an example of a piece of data to illustrate your answer. Each example must be different. Char
String
Boolean
3 (a) Give an example of a conditional statement using pseudocode
(b) Describe the purpose of a conditional statement.
4 This section of program code may be used as a validation check.
1 PRINT "Input a value between 0 and 100 inclusive"
2 INPUT Value
3 WHILE Value < 0 OR Value > 100
4 PRINT "Invalid value, try again"
5 INPUT Value
6 ENDWHILE
7 PRINT "Accepted: ", Value
(a) Give a name for this type of validation check.
............................................................................................................................................. [1]
(b) Describe what is happening in this validation check.
...................................................................................
c) Complete the trace table for this program code using the test data: 200, 300, -1, 50, 60 Value OUTPUT
(d) Draw a flowchart to represent this section of program code.
5 The table, BEVERAGES, shows the number of calories in 100ml of a range of popular beverages.
It also shows the availability of these drinks in a can, a small bottle and a large bottle.
BevNo BevName Calories Can Small Bottle Large Bottle
Bev01 Cola 40 Yes Yes Yes
Bev02 Lime 45 Yes No Yes
Bev03 Energy Drink 1 52 Yes Yes No
Bev04 Energy Drink 2 43 Yes No No
Bev05 Mango 47 Yes No Yes
Bev06 Lemon Iced Tea 38 Yes No Yes
Bev07 Lemonade 58 Yes Yes Yes
Bev08 Orange Juice 46 Yes Yes No
Bev12 Apple Juice 50 Yes Yes No
Bev15 Chocolate Milk 83 Yes Yes No
(a) Give a reason for choosing BevNo as the primary key for this table.
...................................................................................................................................................
............................................................................................................................................. [1]
(b) State the number of records shown in the table BEVERAGES.
...............................................................................
An auction company has an interactive auction board at their sale rooms, which allows buyers to
place bids at any time during the auction. Before the auction starts, the sellers place their items
in the sale room with a unique number attached to each item (item number). The following details
about each item need to be set up on the interactive auction board system: item number, number of
bids, description and reserve price. The number of bids is initially set to zero.
During the auction, buyers can look at the items in the sale room and then place a bid on the
interactive auction board at the sale room. Each buyer is given a unique number for identification
(buyer number). All the buyer needs to do is enter their buyer number, the item number and their bid.
Their bid must be greater than any existing bids.
At the end of the auction, the company checks all the items and marks those that have bids greater
than the reserve as sold. Any items sold will incur a fee of 10% of the final bid to be paid to the
auction company.
Write and test a program or programs for the auction company.
• Your program or programs must include appropriate prompts for the entry of data, data must be
validated on entry.
• Error messages and other output need to be set out clearly and understandably.
• All variables, constants and other identifiers must have meaningful names.
You will need to complete these three tasks. Each task must be fully tested.
Task 1 - Auction set up.
For every item in the auction the item number, description and the reserve price should be recorded.
The number of bids is set to zero. There must be at least 10 items in the auction.
Task 2 - Buyer bids.
A buyer should be able to find an item and view the item number, description and the current highest
bid. A buyer can then enter their buyer number and bid, which must be higher than any previously
recorded bids. Every time a new bid is recorded the number of bids for that item is increased by one.
Buyers can bid for an item many times and they can bid for many items.
Task 3 - At the end of the auction.
Using the results from TASK 2, identify items that have reached their reserve price, mark them as
sold, calculate 10% of the final bid as the auction company fee and add this to the total fee for all
sold items. Display this total fee. Display the item number and final bid for all the items with bids that
have not reached their reserve price. Display the item number of any items that have received no
bids. Display the number of items sold, the number of items that did not meet the reserve price and
the number of items with no bids.
1 (a) All variables, constants and other identifiers must have meaningful names. Describe the data structures you have used in Task 1 to record the items for sale. Include some sample data for each data structure you have described.
(b) Explain how your program for Task 1 ensures the item number is unique.
(c) Write an algorithm for the part of Task 2 that allows the buyer to add a new bid, using either pseudocode, programming statements or a flowchart. Assume that Task 1 has been completed and that the item details have already been found
(d) Explain how your program for Task 2 checks that a new bid is higher than previous bids for an item.
(e) Explain how your program identifies the items that have reached their reserve price, then calculates and displays the total auction company fee for all sold items as part of Task 3. Any programming statements used in your answer must be fully explained.
2 (a) An algorithm has been written in pseudocode to input 100 numbers, select and print the
largest number and smallest number.
Count 1
INPUT Number
High Number
Low Count
REPEAT
INPUT Number
IF Number > High
THEN
High Number
ENDIF
IF Number > Low
THEN
Low Number
ENDIF
Count Count + 1
UNTIL Count > 99
PRINT "Largest Number is ", Number
PRINT "Smallest Number is ", Low
Find the four errors in the pseudocode and suggest a correction for each error.
(b) Show how you would change the corrected algorithm to total the numbers and print the total. Use a variable Total.
3.A database table, FLIGHT, is used to keep a record of flights from a small airfield. Planes can
carry passengers, freight or both. Some flights are marked as private and only carry passengers.
Flight number Plane Notes Departure time Passengers
FN101 Caravan 1 Private passenger flight 08:00 Y
CN101 Caravan 2 Freight only 08:30 N
CN102 Piper 1 Freight only 09:00 N
FN104 Piper 2 Passengers only 09:20 Y
FN105 Piper 1 Freight and passengers 10:00 Y
FN106 Caravan 1 Passengers only 10:30 Y
CN108 Caravan 2 Freight only 08:00 N
CN110 Lear Private passenger flight 08:00 Y
(a) State the field that could have a Boolean data type.
Managerial Accounting Creating Value in a Dynamic Business Environment
ISBN: 978-0078110917
9th edition
Authors: Ronald W. Hilton