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
Why is Ethics an important part of engineering?
NemiM [27]

Answer:

Products created can change society, for better and for the worse

It was damaged in a fire

8 0
3 years ago
PLEASE HELP AND ANSWER MY OTHER QUESTIONS!,
NARA [144]

Answer: False

Explanation:

The statement that "a person hired by a pharmaceutical company to streamline the company’s drug production process would most likely be an electrical engineer" is false.

An electrical engineer is an engineer that designs, and tests electrical equipment like smartphones, electric motors, etc. The person designs equipments which makes use of electricity or electronics.

He or she doesn't streamline the company’s drug production process, this can be the role played by the production manager.

8 0
3 years ago
A tension member must be designed for a service dead load of 18 kips and a service live load of 2 kips.
ella [17]

Answer:

A) max factored load ( pv = 1.4 * 18 ) = 25.2 kips

B) max load factored load  = ( Pa = 18 + 2 ) = 20 kips

Explanation:

service dead load = 18 kips

service live load = 2 kips

A) Determine the maximum factored load and controlling AISC load combination

max factored load ( pv = 1.4 * 18 ) = 25.2 kips

DL = 18 kips

LL = 2 kips

B) Determine the max load and controlling AISC load combination

max load factored load  = ( Pa = 18 + 2 ) = 20 kips

attached below

4 0
3 years ago
Jnjn freeeeeeeeeeeeeeeeeeeeeeeeeeeeeee pointtttttttttt
kvasek [131]

Answer:

thx

Explanation:

5 0
3 years ago
Read 2 more answers
Saturated steam coming off the turbine of a steam power plant at 40°C condenses on the outside of a 3-cm-outer-diameter, 35-m-lo
Marina86 [1]

Answer:

93.57 KJ/s

Explanation:

Rate of heat transfer from the steam to the cooling water = mass rate  ×  Heat of vaporization of water at 40 °C

H vaporization of water 40 °C  at saturation pressure = 2406.0 kJ / Kg

rate of heat transfer = 2406.0 kJ / Kg × 140 Kg / ( 60 × 60s) = 93.57 KJ/s

5 0
3 years ago
Other questions:
  • A closed, rigid tank is filled with a gas modeled as an ideal gas, initially at 27°C and a gage pressure of 300 kPa. If the gas
    8·1 answer
  • A ball slowly starts to roll downhill, but its speed increases as it rolls. How are the ball's speed and energy related? - Why d
    9·1 answer
  • Two point charges of values +2.0 and +5.5 μC, respectively, are separated by 0.50 m. What is the potential energy of this 2-char
    11·2 answers
  • The article "Display of Health Risk Behaviors on MySpace by Adolescents"† described a study in which researchers looked at a ran
    10·1 answer
  • The maximum stress that a bar will withstand before failing is called • Rapture Strength • Yield Strength • Tensile Strength • B
    5·1 answer
  • A hot plate with a temperature of 60 C, 50 triangular profile needle wings of length (54 mm), diameter 10 mm (k = 204W / mK) wil
    6·1 answer
  • If the variable step is set to equal 5 and then the code reads step = step + 2, what will step now equal?
    15·1 answer
  • Schrodinger equation is a ........... Equation
    10·1 answer
  • What is the physical mechanism that causes the friction factor to be higher in turbulent flow?
    13·1 answer
  • Technician A says that a circuit with continuity reads 0 ohms. Technician B says that an open circuit reads 0 ohms. Who is corre
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!