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
o-na [289]
4 years ago
8

Fix the code so the program will run correctly for MAXCHEESE values of 0 to 20 (inclusive). Note that the value of MAXCHEESE is

set by changing the value in the code itself. If you are not sure of how it should work then look at the Sample Runs of the next part. This part handles the beginning where it lists all the cheese types available and their prices. Note: it is a very simple fix that needs to be added to all the statements that have an array access.
Engineering
1 answer:
GarryVolchara [31]4 years ago
7 0

Answer:

Code fixed below using Java

Explanation:

<u>Error.java </u>

import java.util.Random;

public class Error {

   public static void main(String[] args) {

       final int MAXCHEESE = 10;

       String[] names = new String[MAXCHEESE];

       double[] prices = new double[MAXCHEESE];

       double[] amounts = new double[MAXCHEESE];

       // Three Special Cheeses

       names[0] = "Humboldt Fog";

       prices[0] = 25.00;

       names[1] = "Red Hawk";

       prices[1] = 40.50;

       names[2] = "Teleme";

       prices[2] = 17.25;

       System.out.println("We sell " + MAXCHEESE + " kind of Cheese:");

       System.out.println(names[0] + ": $" + prices[0] + " per pound");

       System.out.println(names[1] + ": $" + prices[1] + " per pound");

       System.out.println(names[2] + ": $" + prices[2] + " per pound");

       Random ranGen = new Random(100);

       // error at initialising i

       // i should be from 0 to MAXCHEESE value

       for (int i = 0; i < MAXCHEESE; i++) {

           names[i] = "Cheese Type " + (char) ('A' + i);

           prices[i] = ranGen.nextInt(1000) / 100.0;

           amounts[i] = 0;

           System.out.println(names[i] + ": $" + prices[i] + " per pound");

       }        

   }

}

You might be interested in
Problem 2. The length of a side of the square block is 4 in. Under the application of the load V, the top edge of the block disp
White raven [17]

Answer and Explanation:

The answer is attached below

8 0
3 years ago
The author states that chemical engineering is one of the most difficult and complex aspects of engineering. Why do you think th
marishachu [46]

Answer:

hope this helps

Explanation:

answers:

1. Chemical engineering is most difficult because it's a mix of physics, chemistry and math

2. Stoichiometry is so important because it shows how materials react, interact and play off each other

3. Yes I think consumers would notice if process control standards were not met. for example medicines, when people take Tylenol or cold pills, if the amount of time it took to kick it becomes longer, people will become aware that the product is not consistent and reliable.

4. i have no idea sorry :(

5. This is explaining how there are rules and regulations to make the workplace safe. it can be accomplished by following those rules and regulations

8 0
3 years ago
Read 2 more answers
The boy in the wagon begins throwing bricks out of the wagon to simulate rocket propulsion. The wagon begins at rest, and the bo
Digiron [165]

Q:What velocity does the boy attain if he throws the bricks one at a time?

Answer:Linear velocity since it moves back and firth and does not rotate like angular velocity.

5 0
3 years ago
Exhaust gas from a furnace is used to preheat the combustion air supplied to the furnace burners. The gas, which has a flow rate
Monica [59]

Answer:

The total tube surface area in m² required to achieve an air outlet temperature of 850 K is 192.3 m²

Explanation:

Here we have the heat Q given as follows;

Q = 15 × 1075 × (1100 - t_{A2}) = 10 × 1075 × (850 - 300) = 5912500 J

∴ 1100 - t_{A2} = 1100/3

t_{A2}  = 733.33 K

\Delta \bar{t}_{a} =\frac{t_{A_{1}}+t_{A_{2}}}{2} - \frac{t_{B_{1}}+t_{B_{2}}}{2}

Where

\Delta \bar{t}_{a} = Arithmetic mean temperature difference

t_{A_{1} = Inlet temperature of the gas = 1100 K

t_{A_{2} = Outlet temperature of the gas = 733.33 K

t_{B_{1} =  Inlet temperature of the air = 300 K

t_{B_{2} = Outlet temperature of the air = 850 K

Hence, plugging in the values, we have;

\Delta \bar{t}_{a} =\frac{1100+733.33}{2} - \frac{300+850}{2} = 341\tfrac{2}{3} \, K = 341.67 \, K

Hence, from;

\dot{Q} = UA\Delta \bar{t}_{a}, we have

5912500  = 90 × A × 341.67

A = \frac{5912500  }{90 \times 341.67} = 192.3 \, m^2

Hence, the total tube surface area in m² required to achieve an air outlet temperature of 850 K = 192.3 m².

4 0
3 years ago
Which option is an example of a physical model?
Burka [1]

Answer:

A. A clay ball with a slice cut out, showing the layers of the earth

Explanation:

6 0
4 years ago
Other questions:
  • A three-point bending test was performed on an aluminum oxide specimen having a circular cross section of radius 5.0 mm (0.20 in
    13·1 answer
  • Define coordination number. How does this differ from atomic packing factor?
    7·1 answer
  • Multiple Choice
    8·2 answers
  • Airplanes are the only way that people can take flight.<br> A. True<br> B. False
    14·2 answers
  • A clean machine is a _______________ machine.
    11·1 answer
  • Describe two fundamental reasons why flexural strength should depend on porosity
    14·1 answer
  • What were some of the challenges to safety resulting from such radical airframe designs as highly swept wings, high wing loading
    15·1 answer
  • I feel so pressured..
    10·2 answers
  • What is the creative process that helps you overcome writer's block called?
    13·1 answer
  • What is the correct procedure for mounting the m240 on the m122a1 tripod after the pintle is attached to the receiver?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!