Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem to solve: A high-end department store has chosen five customers at random and will issue each of those customers a gift card based on

Problem to solve:

A high-end department store has chosen five customers at random and will issue each of those customers a gift card based on the total the customer spent that month. The value of the gift card will be the percentage of the amount spend for that customer thus increasing the total they are credited spending. For example, Jeremy has spent $145.42 on purchases but was given a gift card worth 34.06% of the $145.42 spent ($49.53)

Help Include parallel arrays for:

oNames-will hold five names

oAmount spent-will be a randomly generated value between 0 and 500

oGift card amount-will be a randomly generated value between-and 50

oTotals-will be the sum of the amount spent and the amount determined by the gift card

percentage * the amount spent.

Help include The function code to

  • ogetAmountSpent()-no parameters
  • ogetGift()-no parameters
  • ogetSumTotals-array parameter
  • ofindLargeCustomer-array parameter

Help Modify the total button

  • oCalculate the total of all customer totals
  • oCalculate the average of the customer totals
  • oIdentify thepersonwho has the highest current

The code that I have so far:

image text in transcribed
} Ii: This function will nd and return the POSITION of the largest value in its parameter variable, array a. '7 function ndLargePosition(a){ your code } f" Assign to a new array (names) 5 string values represneting the customers. Use an initializer list to do this. {...names...} '7 var names = your array initializer list here It. Create a new array (spent) with length 5; You must use a loop and call the function getAmountSpent to assign to each element in the array the appropriate random value. Make sure the values you are assigning are numbers. and round the values to 2 decimal places. '7 var spent = \"create your array your code toll the array fl: Create a new array (gifts) with length 5; You must use a loop and call the function getGift to assign to each element in the array an appropriate random value. Make sure the values you are assigning are numbers *1 var gifts = \"create your Array \"your code to ll array 1* Create a new array (totals) with length 5; You must use a loop ato fill the array. The values in the array represent: Amount spent + the very generous gift. The values in gifts are numbers between 0 and 50

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

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions