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
Arte-miy333 [17]
3 years ago
15

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
Computers and Technology
1 answer:
PtichkaEL [24]3 years ago
8 0

Answer:

Explanation:

the answer is also in the question. The loop is used to control the number of  program execution. So in order not to run forever, the loop should be included inside the loop brackets. Then you can restructure the code as done below.

var numItems = promptNum("How many items?");

var total = 0;

var itemPrice=0;

while (numItems > 0){

itemPrice = promptNum("Enter next item price");

total = total + itemPrice;

numItems = numItems - 1;

}

console.log("The total is" + total);

The value to be displayed will be the total of the item prices inputted.

You might be interested in
In what year was the first permanent photographic image created?
kvv77 [185]

Answer:

1826

Explanation:

it was in 1826 when the first permanent photographic image was created.

5 0
2 years ago
Members of the sales team use laptops to connect to the company network. While traveling, they connect their laptops to the inte
coldgirl [10]

Answer: Network access control (NAC)

Explanation:

The solution that should be used is the network access control. Network access control helps in keeping devices and users that are unauthorized out of ones private network.

In this case, since one will like to prevent the laptops from connecting to the network unless anti-virus software and the latest operating system patches are installed, then the network access control can be used. One can only give access to the device that it wants to give access to and prevent others from connecting.

3 0
2 years ago
Good business ethics is a good marketing strategy. Discuss
Arada [10]
Good business ethics are the key to good marketing and success. Ethics portray whether an individual has good judgment, intelligence, and many more things that are essential to business. Without good ethics business as a whole would be ruthless. Some business ethics are even required by the law in some places and there are rules and regulation to trade. 

Hope that answered your question!
6 0
3 years ago
Briefly define each components of information systems (hardware, software, data, networking, people and procedure). While you ar
WARRIOR [948]

Answer:

1. Hardware is the physical components that compose a system and provide physical quantity and quality to software applications and accomplish information processing tasks

2. Software is a program that carries out a set of instructions written in a programming language. It instructs a computer on how to carry out specific tasks. Programs can be saved permanently or temporarily.

3. Data may be mostly the raw resources used by information systems experts to give business intelligence to users. Traditional alphanumeric data, which is made up of numbers and alphabetical and other characters, is one type of data.

4. Networking is a resource of any computer system connected to other systems via a communications. It refers to the physical connections between all of the network's nodes. Communication networks are a critical resource component of all information systems, according to networking.

5. People are those who are directly or indirectly involved in the system. Direct users include developers, programmers, designers, and system administrators. Direct users can also be the stakeholder or end user who receives an output from the system. Indirect can be a manager who takes a brief check at the system to check that all criteria are satisfied.

6. Procedure is made up of stages or phases that result in an output. A method of continually receiving feedback on each part while analyzing the overall system by observing various inputs being processed or altered to create outputs.

7 0
1 year ago
ZeroIt is a function that takes one argument and returns no value. The argument is a pointer to int. The function stores the val
Sedbober [7]

Answer:

zeroIt(&x);

Explanation:

The statement that sets the value stored in x to zero by invoking the function zerolt is given below

zeroIt(&x);

The zeroIt function is also given below for better understanding.

void zeroIt(int *x) {

   *x = 0;

}

As seen, the function takes an argument with integer variable type, which is a pointer, denoted by the asterisk symbol (*x).

The ampersan sign (&x) is used to access the variable whose value can then be stored.

7 0
3 years ago
Other questions:
  • In some cases, certain Hyper-V guest operating system features do not function properly using the operating system's own device
    9·1 answer
  • Print either "Fruit", "Drink", or "Unknown" (followed by a newline) depending on the value of userItem. Print "Unknown" (followe
    13·1 answer
  • La computadora es un medio de comunicacion moderno?
    8·1 answer
  • A client contacted you to request your help in researching and supplying the hardware necessary to implement a SOHO solution at
    5·1 answer
  • Project using simple formulas
    15·1 answer
  • In the URL, what is the subdomain and what is the domain name?
    5·1 answer
  • Write a test program that prompts the user to enter three sides of the triangle (make sure they define an actual triangle), a co
    5·1 answer
  • Communication media that use an antenna for transmitting data through air or water are called _____.
    14·1 answer
  • Why did the i have a dream speech happen
    8·1 answer
  • What sort of negative outcomes are possible for this type of risk?
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!