Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A local Apple store needs a program to automatically analyze its monthly sale. The manager would like to gain insight on how popular different categories

A local Apple store needs a program to automatically analyze its monthly sale. The manager would like to gain insight on how popular different categories of Apple products are in her store. She knows the total daily sale values of the following four categories: Mac, iPhone, iPad, and iPod from the following sales report:

Category

Day of Month

Mac

iPhone

iPad

iPod

1

$11500

$1100

$900

$0

2

$9000

$5000

$4300

$300

3

$13000

$3400

$0

$120

4

Your programs input is 5 lists such as follows. The number of values inside each list might be up to 31 values for 31 days.

int[] days = {1,2,3};

int[] mac = {11500,9000,13000};

int[] iphone = {1100,5000,3400};

int[] ipad = {900,4300,0};

int[] ipod = {0,300,120};

The manager wants your program to answer the following four questions.

How many days are in this period? (e.g. 28, 30, 31)

What is the total sale for each category of product?

What is the most popular product category, based on the total sale in this period?

What day the store has the highest total sale over all categories?

**** Each question should be answered in a method which input and return as follows (do not use void methods)

public static int numberOfDays( int[] days)

Input: a list of days

Return: one integer number (total number of days)

public static int[] totalSale( int[] mac, int[] iphone, int[] ipad, int[] ipod )

Input: 4 lists

Return: a list of 4 integer numbers (each representing the total sale of a product category)

public static int popularProduct( int[] totalSaleValues)

Input: a list of 4 integer numbers

Return: one integer number (the index of the most popular category 0 for Mac, 1 for iPhone, )

public static int popularDay(int days[], int[] mac, int[] iphone, int[] ipad, int[] ipod )

Input: 5 lists

Return: one integer number (the day with the highest total sale)

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

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions

Question

Assess three steps in the selection process.

Answered: 1 week ago

Question

Identify the steps in job analysis.

Answered: 1 week ago