Question: JavaScript functions Assignment04B In this assignment, students will create a change-counting game that gets the user to enter the number of coins required to make

JavaScript functions

Assignment04B

In this assignment, students will create a change-counting game that gets the user to enter the number of coins required to make exactly one dollar. The program should accept from the user the number of pennies, nickels, dimes, and quarters. The program calls a function to calculate the total, and returns a string message.

Complete the solution by writing code in the addUpChangefunction.

Notes:.

If the total value of the coins entered is equal to one dollar, the function should return a string that congratulates the user for winning the game.b.

This is the EXACTconfirmation text you should use:

You win. That is exactly$1.00!

Otherwise, the function should return a string indicating whether the amount entered was more than or less than one dollar. Examples of this message appear below. Please follow the pattern of the message exactly.

You lose. 0.48 is less than $1.00

You lose. 1.23 is more than $1.00

If the user provides any piece of data that is not numeric, the function should return this EXACTerror message: Bad data. Please try again.

Test your work.

JavaScript functions Assignment04B In this assignment, students will create a change-counting game

2 UL 5 5 7 3 // Create a change-counting game that gets the user to enter the number of coins 1 required to make exactly one dollar. The program should accept from the user // the number of pennies, nickels, dimes, and quarters. The program calls a function // to calculate the total, and return a string message. 9 1 2 // If the total value of the coins entered is equal to one // dollar, the function should return a string that congratulates the user for // winning the game. 7 // This is the EXACT confirmation text you should use: // You win. That is exacly $1.00! // Otherwise, the function sould return a string indicating // whether the amount entered was more than or less than one dollar. // Examples of this message appear below. Please follow the // pattern of the message exacly. 2 1 3 1 // You lose. 0.48 is less than $1.00, // You lose. 1.23 is more than $1.00 5 // If the user provides any piece of data that is not numeric, the function // should return this is the EXACT error message: // Bad data. Please try again

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!