Question: 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

 Create a change-counting game that gets the user to enter thenumber of coins // required to make exactly one dollar. The program

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 return a string message.

//

// 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.

//

// 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.

//

// 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 is the EXACT error message:

//

// Bad data. Please try again.

Please help me write the correct code I have no idea what I am doing thank you

45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 // 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 return a string message. // // 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. // // 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. 61 62 63 64 65 66 67 68 69 // 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 is the EXACT error message: // // Bad data. Please try again. function addUpChange(numberOfPennies, numberOfNickles, numberOfDimes, numberOfQuarters) { IIIIIIIII // Insert your code between here and the next comment block. // any code in any other part of this file. Do not alter // // var amountPenny = (numberOfPennies * 0.01) var amountNickel = (numberOfPennies * 0.05) var amountDime = (numberOfDimes * 0.10) var amountQuarter = (numberOfQuarters * 0.25) var amount = (amount Penny + amountNickel + amountDime + amountQuarter); if (amount1);{ return ("You lose.' +message+ ' is more than $1.00.'); } else (amount==1); [ return 'You win! That is exactly $1.00!"|| 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 // // Insert your code between here and the previous comment block. // any code in any other part of this file. // Do not alter // // } $('#btn_1').click(function() { let numberOfPennies = $('#textEnteredl').val(); let numberOfNickles = $('#textEntered2').val(); let numberOfDimes = $('#textEntered3').val(); let numberOfQuarters = $('#textEntered4').val(); let message = addUpChange (numberOfPennies, numberOfNickles, numberOfDimes, numberOfQuarters); $('#textDisplayed1').html(message); });

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!