Question: Hello: Need help with this program. In JavaScript please // Assume hot dogs come in packages of 10, and hot dog buns come in packages

Hello:

Need help with this program. In JavaScript please

// Assume hot dogs come in packages of 10, and hot dog buns come in packages of 8.

// Write a program that calculates the number of packages of hot dogs and the

// number of packages of hot dog buns needed for a cookout, with the minimum amount

// of leftovers. The program should ask the user for the number of people attending

// the cookout. Assume each person will eat 1 hotdog.

//

// The program should display the following details:

//

// The minimum number of packages of hot dogs required

// The minimum number of packages of hot dog buns required

// The number of hot dogs that will be left over

// The number of hot dog buns that will be left over

//

// Hint: You might want to use the % operator in one of your calculation

//

function packagesNeeded(numberOfPeople, itemsPerPack) {

Hello: Need help with this program. In JavaScript please // Assume hotdogs come in packages of 10, and hot dog buns come in

6 7 8 9 // Assume hot dogs come in packages of 10, and hot dog buns come in packages of 8. // Write a program that calculates the number of packages of hot dogs and the // number of packages of hot dog buns needed for a cookout, with the minimum amount // of leftovers. The program should ask the user for the number of people attending // the cookout. Assume each person will eat i hotdog. // The program should display the following details: 15 16 // // The minimum number of packages of hot dogs required The minimum number of packages of hot dog buns required The number of hot dogs that will be left over The number of hot dog buns that will be left over 19 /1 Hint: You might want to use the % operator in one of your calculation function packagesNeeded (numberOfPeople, itemsPerPack) { 11 // Insert your code between here and the next comment block. Do not alter // any code in any other part of this file. // Insert your code between here and the previous comment block. Do not alter // // any code in any other part of this file. function leftovers (numberOfPeople, itemsPerPack) { // // Insert your code between here and the next comment block. Do not alter // any code in any other part of this file. 45 M INIMUM // Insert your code between here and the previous comment block. Do not alter // // any code in any other part of this file. 48 HITTITUTI 49 // Hint: You might want to use the % operator in one of your calculation 22 function packagesNeeded (numberOfPeople, itemsPerPack) // Insert your code between here and the next comment block. Do not alter // any code in any other part of this file. // // // Insert your code between here and the previous comment block. Do not alter // // any code in any other part of this file. TTITTITTI 34. M ] function leftovers (numberOfPeople, itemsPerPack) { 41 // Insert your code between here and the next comment block. Do not alter // any code in any other part of this file. // Insert your code between here and the previous comment block. Do not alter // // any code in any other part of this file. III/IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII///// 48 49 50 51 var numberOfPeople = parseInt(prompt('How many people will be attending the cookout? ')); var packagesOfHotDogs = packagesNeeded (numberOfPeople, 10); var leftoverHotDogs = leftovers (numberOfPeople, 10); var packagesOfBuns = packagesNeeded (numberOfPeople, 8); var leftoverBuns = leftovers (numberOfPeople,8); alert( 'We will need ' + packagesOfHotDogs + ' packages of hot dogs and will have ' + leftoverHotDogs + ' leftover.'); alert( 'We will need ' + packagesOfBuns + ' packages of buns and will have ' + leftoverBuns + ' leftover.')

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!