Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

More Books

Students also viewed these Databases questions

Question

Develop a program for effectively managing diversity. page 303

Answered: 1 week ago

Question

List the common methods used in selecting human resources. page 239

Answered: 1 week ago