1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
loris [4]
3 years ago
5

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?line 0 -- var numItems = promptNum("How many items?");line 1-- var total = 0;line 2-- while (numItems > 0){line 3-- total = total + promptNum("Enter next item price");line4-- }line 5-- console.log("The total is" + total);A) Change Line 1 to:var total = -1;B) Change Line 2 to:while (itemsInCart >= 0){C) Change Line 3 to:total = promptNum("Enter next item price");D) Add after line 3:numItems = numItems - 1;E) Add after line 4:numItems = 0;
Computers and Technology
1 answer:
Katyanochek1 [597]3 years ago
8 0

Answer:

Option D is the correct answer for the above question.

Explanation:

  • The above question code executes the infinite while loop because there is no operation in the loop body which helps the loop condition to be false in any iteration of the while loop.
  • Every while loop contains the three thinks, one is starting value for the loop, the second is a condition which states that the body of the loop will execute or not and the third is an operation which states the condition variable to be false or true.
  • The above program has only two think the starting value which is given by the user in numItems variables and the condition check which decides that the value entered should be greater than 0.
  • So to states, the condition will false there needs some increment operation which states the condition variable will be false. So there must be an operation for "numItems" variables because it participates in the condition of the while loop.
  • The operation relates to the "numItems" variable is given only in option D. Hence D is the correct option while the other is not because others do not hold the operation for "numItems" variables.
You might be interested in
Anyone wanna hop on 1v1.lol<br> party code : usfhb6
hjlf

Answer:

thx for the points

Explanation:

8 0
3 years ago
Read 2 more answers
A highly available server is available what percentage of the time?
Verdich [7]

Answer:

b. 99.99%

Explanation:

<u>High available server</u>

A typical dedicated server is a strong machine linked to a high-speed Internet connection and located in a state-of - the-art distant data center or optimized information warehouse.

A dedicated High Availability Server is an sophisticated system with redundant network,redundant power supplies and backups to ensure maximum up-time.

5 0
3 years ago
Internet Security: How can you work securely on the internet? What actions should be avoided and what are the pitfalls?
Cerrena [4.2K]

Answer:First of all, to work safely at the internet you should avoid any not secure page, and if you can’t do that, avoid entering stuff such as credit cards or passwords on this sites. Now, to work safely it’s recomendable to have a VPN(virtual private network), that hides your IP direction.

Explanation:

8 0
3 years ago
.Why is DNS important?
umka2103 [35]

Answer:

 DNS stand for the domain name system and it is used to convert the IP address into the readable system. It basically used to store the data and link with the domain name and the IP address when it is requested.

DNS are important because there is no requirement of memorizing the IP address of huge number of websites and host computer. We only need to remember the domain name of that particular website as it save the IP address of all the particular websites.

In network architecture, the domain name system is very essential and important part.  

8 0
3 years ago
Assign sub_lyric by slicing rhyme_lyric from start_index to end_index which are given as inputs. Sample output with inputs: 4 7
N76 [4]

sub_lyric = rhyme_lyric[start_index:end_index]

8 0
4 years ago
Other questions:
  • Why would Google combining information from separate accounts across its services and sites have privacy implications for its us
    11·1 answer
  • Which sentence in the passage conveys the message that drones can be used in the study of history?
    11·2 answers
  • You administer a Microsoft SQL Server database that supports a banking transaction management application. You need to retrieve
    5·1 answer
  • Which of the following is a definition of conventions?
    8·1 answer
  • Once the data center routes to the destination server that hosts the website, whats the next step in the internet process?
    10·1 answer
  • Assume that the vector arr has been declared. In addition, assume that VECTOR_SIZE has been defined to be an integer that equals
    10·1 answer
  • Given two int variables matricAge and gradAge, write a statement that gives gradAge a value that is 4 more than the value of mat
    11·1 answer
  • I have 2 questions How do i send a picture for someone to answer the hw?
    6·2 answers
  • Whats th diffence between a fwireless speaker and a wird speakr
    12·1 answer
  • which two host names follow the guidelines for naming conventions on cisco ios devices? (choose two.)
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!