Question: Java scripr Objectives In this assignment you will: Demonstrate skills/techniques learned from earlier assignments. Demonstrate the creation of a simple function . Demonstrate the execution

Java scripr

Objectives

In this assignment you will:

  • Demonstrate skills/techniques learned from earlier assignments.
  • Demonstrate the creation of a simple function.
  • Demonstrate the execution of a simple function.

Java scripr Objectives In this assignment you will: Demonstrate skills/techniques learned from

earlier assignments. Demonstrate the creation of a simple function. Demonstrate the execution

of a simple function. Solve this problem Write a JavaScript program that

Solve this problem Write a JavaScript program that solves the following problem: Youie buys 30 different items at the campus bookstore. The bookstore gives a 20% discount if the prices of the items total more than $250. The bookstore charges a 12% sales tax. How many items does Youie purchase? What is the amount of the discount that Youie receives? What is the subtotal cost for the 30 items after the discount has been applied? What is the sales tax amount? What is the total amount that Youie must pay? 3. Use this array of data for the prices of the 30 items purchased: const prices = [6.67, 1.38, 5.77, 20.65, 4.97, 6.40, 7.34, 4.61, 9.81, 8.85, 3.66, 3.38 , 6.68, 6.32, 4.55, 6.55, 70.85, 4.01, 0.81, 8.45, 2.77, 4.38, 5.25, 6.47, 40.22, 6.06, 7.98, 4.02, 2.81, 28.33] ; Instructions The program must meet these criteria: 1. Must follow the standards followed in previous programs: Contains meaningful comments. Uses strict mode to enforce good coding practices. Variables are initialized at the beginning. Uses "const" and "let" correctly. It does not use "var" to initialize variables. All code is valid and easy to read. 2. Create a function named "additemPrices". The function will have no input arguments. Instead, you must declare the array of prices inside the function. The basic format for the function will be like this: // Function to add item prices using an array and a loop. function addItemPrices() { } 3. The contents of the function will be structured to follow the input process output pattern where all the variables are assigned at the beginning of the program, then all the processing is done in the middle of the program, finally, the output is done at the end of the program. In this assignment, make sure that all variables are initialized inside the function, all processing is performed inside the function, and all output is done inside the function. 4. The program must use the array's "length property" to calculate the number of items purchased. 5. Output the following values: Number of items purchased Youie's discount amount The subtotal amount The sales tax amount The total price 6. Finally, after the function, call the function to execute it. Notice that you use the name of the function followed by () to execute the function. It should look something like this: additemPrices()

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!