Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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 cafs. 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 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 ID 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 get Lowest () 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

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_2

Step: 3

blur-text-image_3

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

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions

Question

How do Dimensional Database Models differ from Relational Models?

Answered: 1 week ago

Question

What type of processing do Relational Databases support?

Answered: 1 week ago

Question

Describe several aggregation operators.

Answered: 1 week ago