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
Consider two different types of motors. Motor A has a characteristic life of 4100 hours (based on a MTTF of 4650 hours) and a sh
Daniel [21]

Answer:B

Explanation:

Given

For motor A

Characteristic life(r)=4100 hr

MTTF=4650 hrs

shape factor(B )=0.8

For motor B

Characteristic life(r)=336 hr

MTTF=300 hr

Shape Factor (B)=3

Reliability for 100 hours

R_a=e^{-\left ( \frac{T-r}{n}\right )B}

R_a=e^{-\left ( \frac{4650-4100}{100}\right )0.8}

R_a=e^{-4.4}=0.01227

For B

R_b=e^{-\left ( \frac{300-336}{100}\right )3}

R_b=e^{1.08}=2.944

B is better for 100 hours

(b)For 750 hours

R_a=e^{-0.5866}=0.55621

R_b=e^{0.144}=1.154

So here B is more Reliable.

3 0
3 years ago
At what stage of development is an engineering team the most productive?
Alexxx [7]

Answer:

A

Explanation:

A because you are continuing to keep moving and thinking.

3 0
3 years ago
Read 2 more answers
A 1000-MVA, 20-kV, 60-Hz, three-phase generator is connected through a 1000-MVA, 20-kV, Dy345-kV, Y transformer to a 345-kV circ
aniked [119]

Answer:

(a) the subtransient current through the breaker in per-unit and in kA rms =   71316.39kA

(b) the rms asymmetrical fault current the breaker interrupts, assuming maximum dc offset. = 152KA

Explanation:

check the attached files for explanation

7 0
3 years ago
Multiple Choice
12345 [234]

Answer:https://global.oup.com/us/companion.websites/9780199385423/student/ch6/mcq/     just go here

Explanation:

6 0
3 years ago
Which band has an average of $3.58 per hour of parking?
Minchanka [31]
C it would be c because that has more and the others have less
6 0
2 years ago
Other questions:
  • Psychologist who uses behavioral approach to therapy would probably try which of the following
    13·2 answers
  • A non-entrepreneurship, work-based, agricultural type of SAE, in which a student learns and gains skills in a paid or unpaid pos
    15·1 answer
  • Assume the triac of an AC discrete output module fails in the shorted state. How would this affect the device connected to this
    5·1 answer
  • A three-point bending test is performed on a glass specimen having a rectangular cross section of height 5.3 mm and width 11.6 m
    11·1 answer
  • Lets try to get to 100 sub before charismas day <br> Jordan Gracia 32 sub and 5 videos
    13·2 answers
  • Recall the steps of the engineering design process. Compare and contrast the
    9·1 answer
  • There are three homes being built, each with an identical deck on the back. Each deck is comprised of two separate areas. One ar
    7·1 answer
  • I) A sag vertical curve is to be designed to join a 4% grade to a 2% grade. If the design
    6·1 answer
  • There are signs of oil spray on the compressor clutch hub and nearby underhood areas. Technician A says that a faulty compressor
    11·1 answer
  • 18. Bela is doing a continuity test. What's he checking?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!