subject

Tiffany is writing a program to help manage a bake sale. She writes the following code which prompts the user to enter the total number of items a person is buying and then a loop repeatedly prompts for the cost of each item. She wrote the code but there is a problem: it runs in an infinite loop. How can Tiffany change her code so it doesn't loop forever?
0 var numItems = promptNum("How many items?");
1 var total = 0;
2 while (numItems > 0){
3 total = total + promptNum("Enter next item price");
4 }
5 console. log("The total is" + total);
Add after line 3: numItems = numItems - 1;

What value will be displaye

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 14:30
Create a pseudocode design to prompt a student for their student id and the titles of the three classes they want to add. the solution should display the student’s id and a total bill. • bill a student using the following rules: o students can only add up to 3 classes at a time.
Answers: 3
question
Computers and Technology, 22.06.2019 18:30
If an improvement creates no significant change in a product’s performance, then it is a(n) ? a0 design improvement. (there are no answer choices)
Answers: 1
question
Computers and Technology, 25.06.2019 05:00
The ratio of men to women in a certain factory is 3 to 4 .there are 210 men.how many workers are there?
Answers: 2
question
Computers and Technology, 25.06.2019 05:10
Maia notices that her paragraphs are too close to one another. she wants to increase this space. which arrangement of steps does maia follow after she goes to the paragraph command group in the ribbon? type in the space needed, go to the after menu, go to the spacing part of the box, and open the paragraph dialog box. go to the spacing part of the box, go to the after menu, open the paragraph dialog box, and type in the space needed. open the paragraph dialog box, go to the spacing part of the box, go to the after menu, and type in the space needed. type in the space needed, open the paragraph dialog box, go to the after menu, and go to the spacing part of the box.
Answers: 1
You know the right answer?
Tiffany is writing a program to help manage a bake sale. She writes the following code which prompts...
Questions
question
Mathematics, 15.11.2020 04:00
question
Health, 15.11.2020 04:00
question
Mathematics, 15.11.2020 04:00
Questions on the website: 13722361