Professional Documents
Culture Documents
Week 13 Lab 11
Week 13 Lab 11
Lab 11 – Week 13
Exercise 1 [1 mark]
The purpose of the remainder of this lab is to write a program that prints the following
table with the number of busses that pass USP.
Mon Tue Wed Thu Fri Sat Sun
Nasese 34 33 31 35 36 23 20
Raiwai 27 28 26 29 30 18 17
Raiwaqa 37 35 33 35 38 35 34
Vatuwaqa 22 24 23 25 27 26 26
In addition to just printing the table it should compute for each row the total, and
the total for the entire table.
As a first step you are asked to provide the following variable declarations (for the
main function):
• An array of length 4, containing the strings “Nasese”, “Raiwai”, “Raiwaqa”,
“Vatuwaqa”.
• A 2-D array with 4 rows and 7 columns, containing the number in the table above.
Exercise 2 [1 mark]
Write a function that prints the table. The output should look like this:
*******************************
USP bus count
*******************************
Exercise 3 [1 mark]
Provide the following two functions
• One function that given a (one dimensional) integer array and its size,
computes and returns the sum of all elements.
• A second function that given a 2-D array and the number of rows and
columns, computes and returns the sum of all elements.
Exercise 4 [1 mark]
Write a program that add the computation of totals to the table. The output should
look like this:
*******************************
USP bus count
*******************************
It should use the functions that you defined in exercise 3 to compute the totals.