Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A company supplies concrete slabs for paving. The slabs are made to order in batches of 20; all slabs in a batch are identical. Customers

A company supplies concrete slabs for paving. The slabs are made to order in batches of 20;
all slabs in a batch are identical. Customers can order from a small range of standard sizes and
colours. All measurements are given in millimetres. The price is calculated at $0.05 for a volume of
100000mm3 of grey concrete; red and green concrete are charged at 10% more. Customers can
choose their own colours; a custom colour has an initial set up cost of $5 then 15% more than the
price for grey.
Colour of
slab
Depth of
slab Shapes Sizes for each shape
Grey 38 Square 600 × 600 or 450 × 450
Red 45 Rectangular 600 × 700 or 600 × 450
Green Round Diameter 300 or 450
Custom
Write and test a program or programs for the concrete slab 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 - Price for a batch of 20 slabs
Using the information above set up a routine that allows a customer to choose the concrete slab
they require and calculate a price for a batch of 20 slabs. The details of the slab chosen and the
price for a batch of 20 should be displayed on the screen.
Task 2 - Customer places an order
Using the information from TASK 1, the customer places an order for the number of slabs they
require. Orders for fewer than 20 slabs or more than 100 slabs are not accepted; orders that are
not a multiple of 20 are rounded up to the next multiple of 20 slabs. Display the order price and the
number of slabs to be produced.
Task 3 - Flexible pricing
The cost of concrete is variable. The cost for 100000mm3 of grey concrete can be input and two
grades are available; basic at the cost input and best at 7% more. Use a copy of your program for
TASK 1 to develop TASK 3 to input the cost and grade of concrete before calculating the price for
20 slabs.

 

1 (a) All variables, constants and other identifiers must have meaningful names. (i) Describe the data structures that you have used to store the data for the concrete slabs in Task 1, include the name, data type and use for each data structure.

 

(ii) State one variable that you have used in Task 3. Give the data type for the variable. State what it is used for. Variable name ................................................................................................................... Data type ........................................................................................................................... Use ....................................................................................................................................

 

(b) Explain how you calculated the volume of a concrete slab in Task 1.

 

(c) Write an algorithm for Task 2, using either pseudocode, programming statements or a flowchart. Assume that Task 1 has been completed. 

 

(d) Explain how you changed your program for Task 1 to meet the requirements for Task 3. Include and fully explain any altered or additional programming statements. ........

 

2 An algorithm has been written in pseudocode to select a random number using the function RandInt(n), which returns a whole number between 1 and the argument n. The algorithm then allows the user to guess the number. Number RandInt(100) TotalTry 1 REPEAT PRINT "Enter your guess now, it must be a whole number" INPUT Guess IF TotalTry > Number THEN PRINT "Too large try again" ENDIF IF Guess > Number THEN PRINT "Too small try again" ENDIF TotalTry Guess + 1 UNTIL Guess <> Number TotalTry TotalTry - 1 PRINT "Number of guesses ", TotalTry Find the four errors in the pseudocode and suggest a correction to remove each error.

 

You have been asked to write a program to calculate the area of a wall and the cost of the tiles
needed to cover it. The program should work for any room with up to four walls being tiled. Tiles are
sold in boxes; each box covers one square metre.
Tile description Price per box
Small black granite $19.50
Small grey marble $25.95
Small powder blue $35.75
Medium sunset yellow $12.50
Medium berry red $11.00
Medium glitter purple $52.95
Large oak wood effect $65.00
Large black granite $58.98
Large bamboo effect $85.00
Extra-large white marble $62.75
Write and test a program or programs to calculate the area of the walls and the cost of tiles needed
to tile a room.
• 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 arrays, 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 and using the system for a single wall.
Set up your program to:
• Store the tile description, price per box and an identification code using a suitable programming
technique.
• Display the list of tiles including the identification code, description and price per box.
• Prompt the user to input the height and width of the wall, and the identification code of the tiles
they would like.
• Calculate and display the area of the wall, the number of boxes of tiles required (tiles are sold in
boxes of complete square metres) and the total cost of the tiles.
Task 2 - Adding additional walls.
Extend your program to:
• Enter the number of walls to be tiled and the identification code of the tiles to be used. Only one
identification code to be used for all walls. • Enter the dimensions for each wall to be tiled. • Calculate and display the total area of all walls, the number of boxes of tiles required (tiles are
sold in boxes of complete square metres) and the total cost of the tiles.
Task 3 - Allowing for waste.
It is likely that some of the tiles will not be useable so it is sensible to allow a percentage for wastage,
for example 10%. Alter your program to allow the user to input a percentage to calculate wastage
and add this to the total area to be tiled. Calculate and display the revised number of boxes of tiles
to be purchased (tiles are sold in boxes of complete square metres) and the total cost of the tiles.

 

 

1 (a) All variables, constants and other identifiers must have meaningful names. Name two arrays you could use for Task 1. State the data type and purpose of each one. Array 1 ...................................................................................................................................... Data type 1 ............................................................................................................................... Purpose .................................................................................................................................... ................................................................................................................................................... Array 2 ...................................................................................................................................... Data type 2 ............................................................................................................................... Purpose .................................................................................................................................... ................................................................................................................................................... [4] (b) Name a variable that you used for Task 2. State the data type and purpose of this variable. Explain why you chose to use a variable rather than a constant. Variable ..................................................................................................................................... Data type .................................................................................................................................. Purpose .................................................................................................................................... ................................................................................................................................................... ................................................................................................................................................... Reason for use of a variable ..................................................................................................... ....................................................

(c) Write an algorithm for Task 1, using either pseudocode, programming statements or a flowchart. Assume that the first part of Task 1, the storage and display of tile descriptions, prices per box and identification codes has already been done. .....................................................................................................

 

 

(d) Explain how you extended your program to complete Task 2. Any programming statements you use in your answer must be fully explained. ............................

 

(e) Explain how you could validate the input for percentage waste allowance in Task 3. ......

 

 

2 Describe the use of a subroutine in a program.

 

3 Name the three types of loop structure used in pseudocode. ..........................................................................................................................

 

4 The following pseudocode algorithm uses nested IF statements.
IF Response = 1
THEN
X X + Y
ELSE
IF Response = 2
THEN
X X - Y
ELSE
IF Response = 3
THEN
X X * Y
ELSE
IF Response = 4
THEN
X X / Y
ELSE
OUTPUT "No response"
ENDIF
ENDIF
ENDIF
ENDIF
(a) Name the type of statement demonstrated by the use of IF ... THEN ... ELSE ... ENDIF
...................................................................................................................................................
............................................................................................................................................. [1]
(b) Re-write the pseudocode algorithm using a CASE statement.
.........................................................................................

 

5 The algorithm performs an operation on the array named MyData
DIV means integer division, so only the whole number part of the result is returned
e.g. 7 DIV 2 returns a value of 3
First 0
Last 16
Found FALSE
INPUT UserIn
WHILE (First <= Last) AND (Found = FALSE) DO
Middle (First + Last) DIV 2
IF MyData[Middle] = UserIn
THEN
Found TRUE
ELSE
IF UserIn < MyData[Middle]
THEN
Last Middle - 1
ELSE
First Middle + 1
ENDIF
ENDIF
ENDWHILE
OUTPUT Found
This table shows the contents of the array: MyData e.g. MyData[2] stores the value 5
MyData
Index [0] [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16]
Value 2 3 5 6 8 10 12 13 14 16 18 20 25 27 29 34 36
(a) Complete the trace table for the input data: 10
First Last UserIn Middle Found OUTPUT

 

(b) Describe the function being performed by the algorithm.

 

6 Draw four different flowchart symbols and describe how they are used in a program flowchart. Flowchart symbol Description of use 

 

 

7 A teacher has decided to use a database table as her mark book for her Computer Science class, which she has called MARKBOOK. For each student, the following data will be recorded: first name, last name, their year 10 test score and their year 11 test score. The class has 32 students. (a) State the number of fields and records required for this database. Number of Fields ...................................................................................................................... Number of Records .................................................................................................................. [2] (b) The data in MARKBOOK is stored under category headings: LastName, FirstName, Y10TestScore and Y11TestScore. State, with a reason, whether any of these headings would be suitable as a primary key.  ............................................................................................................................................. [2] (c) Complete the query-by-example grid to only display the first name, last name and year 10 test score of each student who achieved 50 or more in their year 10 test. The output should be in test score order with the highest marks at the top of the list. Field: Table: Sort: Show: Criteria: or:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Accounting for Decision Making and Control

Authors: Jerold Zimmerman

8th edition

78025745, 978-0078025747

More Books

Students also viewed these Computer Network questions

Question

What are tire main limitations of stopwatch time study?

Answered: 1 week ago