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
Tech A says that in some cases, the electronic brake control module can be programmed with a new tire size to restore proper ele
Vlad [161]

Answer:

Both Techs A and B

Explanation:

Electronic braking systems are controlled by the electronic brake control module. It is a microprocessor that processes information from wheel-speed sensors and the hydraulic brake system to determine when to release braking pressure at a wheel that's about to lock up and start skidding  and activates the anti lock braking system or traction system when it detects it is necessary.

Some electronic brake control modules can be programmed to the size of the vehicle's new tires to restore proper electronic brake control performance. While others may require replacing the module to match the module's programming to the installed tire size. So, both technicians A and B are correct.

3 0
3 years ago
What is ONE DIFFERENCE between civil structural engineering
Rudiy27

Answer:

One of the differences is that civil engineering focuses on design elements while structural engineering is more concern on inspecting the materials used for construction. The structural engineers are the one who are supposed to ensure that the materials used for construction can support the design of the structure.

Explanation:

3 0
3 years ago
Find the rate of heat transfer through a 6 mm thick glass window with a cross-sectional area of 0.8 m2 if the inside temperature
kiruha [24]

Answer:

6.9

Explanation:

I had the same question lol your welcomr if itd not right in sorry

3 0
2 years ago
The Energy Losses Associated with Valves and Fittings: a)- are generally associated with a K factor b)- are generally associated
madam [21]

Answer:

a)Are generally associated with factor.

Explanation:

We know that losses are two types

1.Major loss  :Due to friction of pipe surface

2.Minor loss  :Due to change in the direction of flow

As we know that when any hindrance is produced during the flow of fluid then it leads to generate the energy losses.If flow is along uniform diameter pipe then there will not be any loss but if any valve and fitting placed is the path of fluid flow due to this direction of fluid flow changes and  it produce losses in the energy.

Lot' of experimental data tell us that loss in the energy due to valve and fitting are generally associated with K factor.These losses are given as

Losses=K\dfrac{V^2}{2g}

8 0
3 years ago
A ductile hot-rolled steel bar has a minimum yield strength in tension and compression of Syt = 60 kpsi and Syc = 75 kpsi. Using
kow [346]

Answer:

2.135

Explanation:

Lets make use of these variables

Ox 16.5 kpsi, and Oy --14,5 kpsi

To determine the factor of safety for the states of plane stress. We have to first understand the concept of Coulomb-Mohr theory.

Mohr–Coulomb theory is a mathematical model describing the response of brittle materials such as concrete, or rubble piles, to shear stress as well as normal stress.

Please refer to attachment for the step by step solution.

4 0
3 years ago
Other questions:
  • Air modeled as an ideal gas enters a well-insulated diffuser operating at steady state at 270 K with a velocity of 180 m/s and e
    11·1 answer
  • The working section of a transonic wind tunnel has a cross-sectional area 0.5 m2. Upstream, where the cross-section area is 2 m2
    10·1 answer
  • Which of the following is an example of seeking accreditation?
    7·1 answer
  • Ayuda con este problema de empuje y principio de arquimedes.
    6·1 answer
  • WILL MARK BRAINLIST I need help on this asap thanks
    15·1 answer
  • The current at resonance in a series L-C-R circuit is 0.2mA. If the applied voltage is 250mV at a frequency of 100 kHz and the c
    9·1 answer
  • A hammer can be used to see how a mineral breaks. If you observe square chunks of the mineral when broken, what can you conclude
    15·1 answer
  • What is the importance of the causal link<br> in work accidents?
    11·1 answer
  • In what ways did electrical switches have to change to progress from the
    13·1 answer
  • QUICK ASAP!!!
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!