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]
3 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]3 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
What are the basic parts of a radio system
Romashka-Z-Leto [24]
Today's radio consists of an antenna, printed circuit board, resistors, capacitors, coils and transformers, transistors, integrated circuits, and a speaker. All of these parts are housed in a plastic case. An internal antenna consists of small-diameter insulated copper wire wound around a ferrite core.
4 0
3 years ago
A commercial refrigerator with refrigerant -134a as the working fluid is used to keep the refrigerated space at -30C by rejectin
Mariana [72]

Answer:

a) 0.487

b) refrigeration load = 5.46w

c) cop = 2.24

d)ref load max = 12.43kw

Explanation:

6 0
3 years ago
Read 3 more answers
If the old radiator is replaced with a new one that has longer tubes made of the same material and same thickness as those in th
Nookie1986 [14]

Answer: hello some parts of your question is missing attached below is the missing information

The radiator of a car is a type of heat exchanger. Hot fluid coming from the car engine, called the coolant, flows through aluminum radiator tubes of thickness d that release heat to the outside air by conduction. The average temperature gradient between the coolant and the outside air is about 130 K/mm . The term ΔT/d  is called the temperature gradient which is the temperature difference ΔT between coolant inside and the air outside per unit thickness of tube

answer : Total surface area = 3/2 * area of old radiator

Explanation:

we will use this relation

K = \frac{Qd }{A* change in T }

change in T =  ΔT  

therefore New Area  ( A ) = 3/2 * area of old radiator

Given that the thermal conductivity is the same in the new and old radiators

3 0
3 years ago
A sports car has a drag coefficient of 0.29 and a frontal area of 20 ft2, and is travelling at a speed of 120 mi/hour. How much
Andrej [43]

Answer:

Power required to overcome aerodynamic drag is 50.971 KW

Explanation:

For explanation see the picture attached

4 0
3 years ago
Fill in the blank to correctly complete the statement below.
frutty [35]

Answer:

The invention of the pendulum-driven ___<u>clocks</u>___ in the 1600s paved the way for a new industrial era.

4 0
3 years ago
Other questions:
  • Wastewater flows into a once it is released into A floor drain
    11·1 answer
  • Ignore swell and shrinkage for this problem.
    5·1 answer
  • Consider a very long, cylindrical fin. The temperature of the fin at the tip and base are 25 °C and 50 °C, respectively. The dia
    14·1 answer
  • Who is the best musician in Nigeria<br>​
    11·2 answers
  • An insulated tank having a total volume of 0.6 m3 is divided into two compartments. Initially one compartment contains 0.4 m3 of
    8·1 answer
  • You will create three classes, the first two being Student and LineAtOfficeHour. The instances of the first class defines a sing
    8·1 answer
  • Can you screen record on WOW Presents Plus on iPhone?
    12·1 answer
  • . Which of the following formula is used for calculating current:
    15·1 answer
  • 8.28 Water is the working fluid in an ideal Rankine cycle with superheat and reheat. Steam enters the first-stage turbine at 140
    13·1 answer
  • Water flow enters a pipe at a velocity of 1m/s. The pipe inlet is 10cm. The pipe outlet is 6cm. 1. Determine the velocity of the
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!