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
Wqqwfqwfqwfqfqfqffqwffqwqfqqfqfqffqqfqfwccc
almond37 [142]

Answer:

?

Explanation:

4 0
3 years ago
Read 2 more answers
In a production turning operation, the foreman has decreed that a single pass must be completed on the cylindrical workpiece in
stellarik [79]

Answer:

V = 125.7m/min

Explanation:

Given:

L = 400 mm ≈ 0.4m

D = 150 mm ≈ 0.15m

T = 5 minutes

F = 0.30mm ≈ 0.0003m

To calculate the cutting speed, let's use the formula :

T = \frac{pi* D * L}{V*F}

We are to find the speed, V. Let's make it the subject.

V = \frac{pi* D * L}{F*T}

Substituting values we have:

V = \frac{pi* 0.4 * 0.15}{0.0003*5}

V = 125.68 m/min ≈ 125.7 m/min

Therefore, V = 125.7m/min

7 0
3 years ago
D
nadya68 [22]

Any collection of data or information that has been properly structured for quick search and retrieval by a computer is referred to as a database, often known as an electronic database.

<h3>What is electronic database?</h3>
  • Databases are designed to make it easy to save, retrieve, edit, and delete data while carrying out various data-processing tasks. In response to queries, a database management system (DBMS) retrieves data from the database.
  • Databases are briefly discussed after that. See computer science: Information systems and databases; information processing for a comprehensive explanation.
  • A file or collection of files used to store a database.
  • These files' contents can be divided up into records, each of which has one or more fields.
  • The fundamental units of data storage are fields, and each field typically contains data related to one feature or attribute of the thing that the database is describing.
  • Additionally, records are arranged into tables that contain details on the connections between their various fields.
  • A database in the strict sense offers cross-referencing capabilities, despite the fact that the term "database" is used broadly to refer to any collection of information in computer files.
  • Users can quickly search, rearrange, organize, and choose the fields in numerous records to access or produce reports on certain data aggregates using keywords and a variety of sorting instructions.

To Learn more About database Refer To :

brainly.com/question/518894

#SPJ1

5 0
1 year ago
The following laboratory test results for Atterberg limits and sieve-analysis were obtained for an inorganic soil. [6 points] Si
alexira [117]

Answer: hello the complete question is attached below

answer:

A) Group symbol = SW

B) Group name = well graded sand , fine to coarse sand

C) It is not a clean sand given that ≤ 50% particles are retained on No 200

Explanation:

<u>A) Classifying the soil according to USCS system</u>

 ( using 2nd image attached below )

<em>description of sand</em> :

The soil is a coarse sand since  ≤ 50% particles are retained on No 200 sieve, also

The soil is a sand given that more than 50% particles passed from No 4 sieve

The soil can be a clean sand given that fines ≤ 12%

The soil can be said to be a well graded sand because the percentage of particles passing through decreases gradually over time

Group symbol as per the 2nd image attached below = SW

B) Group name = well graded sand , fine to coarse sand

C) It is not a clean sand given that ≤ 50% particles are retained on No 200

5 0
3 years ago
Explain why Chloe's design needs to be redone in the following scenario, and recommend the techniques she needs to include in he
Alenkinab [10]

Answer:

She believes he's weak and won't do what needs to be done to become a king.

Explanation:

She says ('I fear thy nature') and calls him 'too full o' th' milk of human kindness' which reflects that she feels his kindness makes him weak and may prevent him from proceeding the plan. Thus, she manipulates him to keep his kindness aside and do what she wishes him to do. She rather belittles him to get her purpose solved and

7 0
3 years ago
Read 2 more answers
Other questions:
  • When a group of firms chooses to work together to turn a non-monopoly market into a monopoly market by securing formal agreement
    8·1 answer
  • An FCC iron-carbon alloy initially containing 0.20 wt% C is carburized at an elevated temperature and in an atmosphere wherein t
    6·1 answer
  • A company specification calls for a steel component to have a minimum tensile strength of 1240 MPa. Tension tests are conducted
    7·1 answer
  • How to solve circuit theory using mesh analysis<br>​
    11·1 answer
  • What can you add to a seatbelt ??<br> HELP ASAP
    15·1 answer
  • Best known for his invention of the pressure-ignited heat engine that bears his name,
    5·1 answer
  • (20 points) A 1 mm diameter tube is connected to the bottom of a container filled with water to a height of 2 cm from the bottom
    12·1 answer
  • a coiled spring is stretched 31.50 cm by a 2.00N weight. How far is it stretched by a 10.00 N weight?
    6·1 answer
  • Can you help me with this task/homework.
    11·1 answer
  • A ____ is either in the pressure reducer or in the downstream side of the system to ensure that the control air pressure does no
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!