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
The Clausius inequality expresses which of the following laws? i. Law of Conservation of Mass ii. Law of Conservation of Energy
DanielleElmas [232]

Answer:

(iv) second law of thermodynamics

Explanation:

The Clausius  inequality expresses the second law of thermodynamics it applies to the real engine cycle.It is defined as the cycle integral of change in entropy of a reversible system is zero. It is nothing but mathematical form of second law of thermodynamics . It also states that for irreversible process the cyclic integral of change in entropy is less than zero

3 0
3 years ago
The atmosphere within a room is at 70 °F dry-bulb temperature, 50 percent degree of saturation, and 14.696 psia pressure. The in
Gre4nikov [31]

Answer:

Given that the temperature of the window is below the dew point it will condensate.

Explanation:

A psychrometric chart (like the one attached) will give you the information needed. This chart is for 14.696 psia.

On the bottom horizontal axes you have the dry-bulb temperature, in this case 70°F, going up from this point you can reach the 50% relative humidity curve (red point on chart), going horizontally from this point to the 100% relative humidity you get the dew point temperature (the point at which moisture will condensate) (blue point on chart). In this case the dew point is 50°C. Given that the temperature of the window is below the dew point it will condensate.

6 0
3 years ago
Consider a drug-eluting balloon catheter deployed into a blood vessel. The balloon is inflated to perfectly adhere to the vessel
GaryK [48]

Answer:

a)  Cr = Co - Fx / D

b)   ΔC / Δx = ( CR - Cr )  / ( xR - xRo )

Explanation:

A) Derive an expression for the profile c(r) inside the tissue

F = DΔC / X  = D ( Co - Cr ) / X   ------ 1

where : F = flux , D = drug diffusion coefficient

            X = radial distance between Ro and R

Hence : Cr = Co - Fx / D

B) Express the diffusive flux at outer surface of the balloon

Diffusive flux at outer surface =  ΔC / Δx = CR - Cr / xR - xRo

6 0
3 years ago
Information such as tolerances and scale can be found in the _______________ of an engineering drawing.
nasty-shy [4]

Answer:

Information such as tolerance and scale can be found in the <u>title block</u> of an engineering drawing

Explanation:

The title block of an engineering drawing can normally be found on the lower right and corner of an engineering drawing and it carries the information that are used to specify details that are specific the drawing including, the name of the project, the name of the designer, the name of the client, the sheet number, the drawing tolerance, the scale, the issue date, and other relevant information, required to link the drawing with the actual structure or item

8 0
2 years ago
Consider a junction that connects three pipes A, B and C. What can we say about the mass flow rates in each pipe for steady flow
Elis [28]

Answer:

The statement regarding the mass rate of flow is mathematically represented as follows \Rightarrow \rho \times Q_{3}=\rho \times Q_{1}+\rho \times Q_{2}

Explanation:

A junction of 3 pipes with indicated mass rates of flow is indicated in the attached figure

As a basic sense of intuition we know that the mass of the water that is in the pipe junction at any instant of time is conserved as the junction does not accumulate any mass.

The above statement can be mathematically written as

Mass_{Junction}=Constant\\\\\Rightarrow Mass_{in}=Mass_{out}

this is known as equation of conservation of mass / Equation of continuity.

Now we know that in a time 't' the volume that enter's the Junction 'O' is

1) From pipe 1 = V_{1}=Q_{1}\times t

1) From pipe 2 = V_{2}=Q_{2}\times t

Mass leaving the junction 'O' in the same time equals

From pipe 3 = V_{3}=Q_{3}\times t

From the basic relation of density, volume and mass we have

\rho =\frac{mass}{Volume}

Using the above relations in our basic equation of continuity we obtain

\rho \times V_{3}=\rho \times V_{1}+\rho \times V_{2}\\\\Q_{3}\times t=Q_{1}\times t+Q_{2}\times t\\\\\Rightarrow Q_{3}=Q_{1}+Q_{2}

Thus the mass flow rate equation becomes \Rightarrow \rho \times Q_{3}=\rho \times Q_{1}+\rho \times Q_{2}

6 0
3 years ago
Other questions:
  • A furnace wall consisting of 0.25 m of fire clay brick, 0.20 m of kaolin, and a 0.10‐m outer layer of masonry brick is exposed t
    8·1 answer
  • A thermoelectric refrigerator is powered by a 16-V power supply that draws 2.9 A of current. If the refrigerator cools down 3.1
    11·1 answer
  • The primary transformer voltage is 2.8 kV and the secondary is 230 V. The transformer is connected to a variable load (0 to 300
    8·1 answer
  • Shear modulus is analogous to what material property that is determined in tensile testing? (a)- Percent reduction of area (b) Y
    11·1 answer
  • 3. (20 points) Suppose we wish to search a linked list of length n, where each element contains a key k along with a hash value
    7·1 answer
  • There are three options for heating a particular house: a. Gas: $1.33/therm where 1 therm=105,500 kJ b. Electric Resistance: $0.
    9·1 answer
  • A column carries 5400 pounds of load and is supported on a spread footing. The footing rests on coarse sand. Design the smallest
    10·1 answer
  • Multiple Choice
    6·1 answer
  • What is the fastest plane in the world
    13·2 answers
  • 1) Plastics that soften when heated,harden when cooled, and then can be heated and softened many times
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!