a. The lockdown that has been imposed in the country have caused many businesses to be at a loss. This includes Cafe Coffee which has four branches here in Malaysia. The continuous losses have forced the owners to close down one of the cafes. Table 1 shows the sales made by each of its branches for the year 2019 to 2021. Declare a 2D array called sales that can store this information. Initialise the array with values shown in Table 1. Table 1: Sales made by Café Coffee branches between 2019-2021 Café No 2021 2020 2019 1 319 360 389 2 297 343 369 3 305 314 347 4 338 355 332 *All values are in thousands

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
a. The lockdown that has been imposed in the country have caused many businesses to be at a loss.
This includes Café Coffee which has four branches here in Malaysia. The continuous losses
have forced the owners to close down one of the cafés. Table 1 shows the sales made by each
of its branches for the year 2019 to 2021. Declare a 2D array called sales that can store this
information. Initialise the array with values shown in Table 1.
Table 1: Sales made by Café Coffee branches between 2019-2021
Café No
2021
2020
2019
1
319
360
389
2
297
343
369
3
305
314
347
338
355
332
*All values are in thousands
b. Based on the 2D array that you have declared and initialised in Question 2(a), write codes that
will calculate the average sales for each of the four branches. Declare 1D array called average
to store the average value. Then, display the average sales of each café as the output. Make sure to
declare all variables that you have used other than the sales array.
c. To decide which branch they should close down, the owners are interested to identify the branch
with the lowest average sales. Write a function called getLowest () that will receive the
average array as a parameter. The function will compare all sales average and determine the
lowest value. The value should be stored in a variable called lowest which should be returned to
the main function.
Transcribed Image Text:a. The lockdown that has been imposed in the country have caused many businesses to be at a loss. This includes Café Coffee which has four branches here in Malaysia. The continuous losses have forced the owners to close down one of the cafés. Table 1 shows the sales made by each of its branches for the year 2019 to 2021. Declare a 2D array called sales that can store this information. Initialise the array with values shown in Table 1. Table 1: Sales made by Café Coffee branches between 2019-2021 Café No 2021 2020 2019 1 319 360 389 2 297 343 369 3 305 314 347 338 355 332 *All values are in thousands b. Based on the 2D array that you have declared and initialised in Question 2(a), write codes that will calculate the average sales for each of the four branches. Declare 1D array called average to store the average value. Then, display the average sales of each café as the output. Make sure to declare all variables that you have used other than the sales array. c. To decide which branch they should close down, the owners are interested to identify the branch with the lowest average sales. Write a function called getLowest () that will receive the average array as a parameter. The function will compare all sales average and determine the lowest value. The value should be stored in a variable called lowest which should be returned to the main function.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY