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 150-lb man sits in the center of the boat, which has a uniform width and a weight per linear foot of 3 lb&gt;ft. Determine t
irina1246 [14]

Answer:

M = 281.25 lb*ft

Explanation:

Given

W<em>man</em> = 150 lb

Weight per linear foot of the boat: q = 3 lb/ft

L = 15.00 m

M<em>max</em> = ?

Initially, we have to calculate the Buoyant Force per linear foot (due to the water exerts a uniform distributed load upward on the bottom of the boat):

∑ Fy = 0  (+↑)     ⇒    q'*L - W - q*L = 0

⇒       q' = (W + q*L) / L

⇒       q' = (150 lb + 3 lb/ft*15 ft) / 15 ft

⇒       q' = 13 lb/ft   (+↑)

The free body diagram of the boat is shown in the pic.

Then, we apply the following equation

q(x) = (13 - 3) = 10   (+↑)

V(x) = ∫q(x) dx = ∫10 dx = 10x   (0 ≤ x ≤ 7.5)

M(x) = ∫10x dx = 5x²  (0 ≤ x ≤ 7.5)

The maximum internal bending moment occurs when x = 7.5 ft

then

M(7.5) = 5(7.5)² = 281.25 lb*ft

8 0
3 years ago
Technician A says a solenoid is not used on modern automobiles. Technician B says fuel injectors and starter motor solenoids are
julia-pushkina [17]

Answer:

ON THE BOTTOM

Explanation:

red cord plus black cord

5 0
3 years ago
How do you keep the weight evenly distributed on a trailered boat?
Neporo4naja [7]
C because i know what i’m taking about
7 0
3 years ago
Q5
Klio2033 [76]

The C++ code that would draw all the iterations in the selection sort process on the array is given below:

<h3>C++ Code</h3>

#include <stdio.h>

#include <stdlib.h>

int main() {

   int i, temp1, temp2;

   int string2[16] = { 0, 4, 2, 5, 1, 5, 6, 2, 6, 89, 21, 32, 31, 5, 32, 12 };

   _Bool check = 1;

   while (check) {

       temp1 = string2[i];

       temp2 = string2[i + 1];

       if (temp1 < temp2) {

           string2[i + 1] = temp1;

           string2[i] = temp2;

           i = 0;

       } else {

           i++;

           if (i = 15) {

               check = !check;

           }

       }

   }

   

   return 0;

}

Read more about C++ programming here:

brainly.com/question/20339175

#SPJ1

5 0
1 year ago
You are asked to design a software package for an On-line Banking System (OBS). The OBS will take requests from its user on the
Anit [1.1K]

Answer:

From the statements described above,The proposed software package Online Banking System(OBS) shall provide the following services to the customer(account holder)

Receive all transaction requests from the customers trough online to perform banking activities

Offer a variety of services in banking like:

Opening an account with facilities of Savings,Checking and CD

Issuing checks and check clearance

Transfer of funds between savings and checking account

Establishing a CD(Certificate of Deposit)

Performing routine activities like

Deposit or withdraw funds from a checking account

Closing an account in one of the following operation

Complete closure of account

Closing only savings account

Withdraw CD (on Maturity of CD deposits) and close CD account

Unlike traditional Banking system, OBS offers all the operations through On-line mode over the internet thereby it eliminates manual intervention for the banking transactions from the Bank's side for most of the transactions except some cases like verification of new account applications or complaint redressal and technical support .In such cases ,There will be some users of the software with special privileges to access certain services to perform activities like user data verification and technical support.

Step:1 Identification of actors and software entities for the system to be implemented

The following are the actors identified in the system

Actors:

The users of the proposed system were classified as:

Customer : A user with an active account

Guest user:The user who applies for an account

Administrator:Maintainsand Controls OBS

Manager: Manages the transactions and Banking related issues

Technical Manager: Resolves technical issues of customers

Software entities:

Bank database :Maintains the data of all user accounts

Application server : Maintains the application software components and hosts the OBS website

Automatic Clearing House system : Processes transactions for checks

Step 2: Designing use cases

Use case diagrams are used to describe the system model by representing a set of use cases .Each use case represents a set of actions performed on the system by an actor.

The following are the two approaches of representing the system in a use case model:

1.Representing a use case for actions done by actors e.g. login , logout,message etc.,

2.Representing a use case for business process(Business use cases) e.g. transfer,registration etc.,

The following is the description of five possible business use cases for the requirements specified above

3 0
3 years ago
Other questions:
  • Which of the following scenarios describes someone who is a materials engineer?
    13·1 answer
  • Identify which sound type each line contains.
    10·1 answer
  • A transmitter has an output power of 0.1mW while the fiber has coupling loss of 12dB, attenuation of
    11·1 answer
  • What are four engineering degrees that can help lead you to becoming an aerospace engineer
    6·1 answer
  • Discuss the difference between the observed and calculated values. Is this error? If yes, what is the source?
    15·1 answer
  • What is the purpose of a heater core
    5·2 answers
  • Which part does NOT rotate when the engine is running and the clutch pedal is depressed?
    7·1 answer
  • a buyer can purchase 70 screwdrivers ten 4-inch length twelve 6 inch length twenty 8-inch length are needed. how many heavy 24-i
    6·1 answer
  • Hello, I have a question, I would be glad if you can help.
    5·1 answer
  • How are sedimentary - gravity flows different from fluid - gravity flows
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!