Question: Using Swift , write a program that keeps track the Lemonade sales for five weekdays: Monday, Tuesday, Wednesday, Thursday, and Friday. This program should use

Using Swift, write a program that keeps track the Lemonade sales for five weekdays: Monday, Tuesday, Wednesday, Thursday, and Friday. This program should use two parallel five-element arrays: an array of String that holds the five weekdays and an array of double that holds the sales amount for each day. The weekday names should be stored using an initialization list at the time the name array is created. Use the predefined array literals provided in this assignment to test your logic. This program should produce a report that displays sales for each day, day with the highest sales, day with the lowest sales and total sales for five days. Assume two arrays have the following declarations.

var weekDays = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday"]

var sales = [35.0, 12.5, 57.0, 100.0, 67.5]

The following functions are required in this assignment to calculate the sales results

//get the array index which contains the highest sales

func getMaxIdx(revenue: [Double])->Int{ }

//get array index which contains the lowest sales

func getMinIdx(revenue: [Double])->Int{ }

//calculate total sales for the week

func calcTotalSales(revenue:[Double])->Double{ }

//display report for the sales figures

func displayReport(revenue:[Double], days:[String]){ } 3.

Make sure to apply the followings in your program:

Refer to swift code examples developed in-class and provided in the reading materials

Add comments in your code to document your program

Use descriptive and appropriate variable names/identifiers

Use constant(s) appropriately

Have proper indentation and line spaces in your source code for readability

Have a HEADER comment block (to include your Name, Date created, Description/Purpose of the program)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!