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 10:30
What can tanya do now to start preparing for the college and scholarship application process? think about her grades, activities in which she can get involved, possible part-time jobs at which she can work, and standardized tests she can take. (10 points) apex
Answers: 2
question
Computers and Technology, 23.06.2019 04:00
Write a method that takes in an array of point2d objects, and then analyzes the dataset to find points that are close together. be sure to review the point2d api. in your method, if the distance between any pair of points is less than 10, display the distance and the (x,y)s of each point. for example, "the distance between (3,5) and (8,9) is 6.40312." the complete api for the point2d adt may be viewed at ~pf/sedgewick-wayne/algs4/documentation/point2d.html (links to an external site.)links to an external site.. try to write your program directly from the api - do not review the adt's source code.
Answers: 1
question
Computers and Technology, 23.06.2019 21:20
In microsoft word, when you highlight existing text you want to replace, you're in              a.  advanced mode.    b.  automatic mode.    c.  basic mode.    d.  typeover mode
Answers: 1
question
Computers and Technology, 23.06.2019 22:00
Jackson, who works in the finance department of a company, is holding a seminar for other employees on how to file taxes. only three employees sign up to attend the seminar. which device can he use to share his presentation with a group of three employees?
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, 22.10.2020 20:01
question
Social Studies, 22.10.2020 20:01
Questions on the website: 13722362