GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

Author Archives: Anonymous

The Car class is used to represent information about a car. …

The Car class is used to represent information about a car.  Car objects are created by calls to a constructor with two double parameters. The first parameter represents the maximum amount of fuel the car’s tank can hold.  The second parameter represents the average number of miles the car can travel per gallon of fuel.   The Car class contains a canMakeTrip method, which determines whether there is enough fuel in the car to make a trip. This method has a double parameter that represents the distance, in miles, of a potential trip. If there is enough fuel, the method updates the current amount of fuel in the car and returns true. If there is not enough fuel for the entire distance of the trip, the amount of fuel is unchanged and the method returns false.   The Car class also contains an addGas method, which has a double parameter that represents the amount of gas to add.  This method will add the value of the parameter to the tank until the tank is full.  It will not add more than the tank can hold.  Assume all parameters are positive.  The following table contains a sample code execution sequence and the corresponding results.    Statement Explanation boolean possible; declare a variable to store the result of canMakeTrip Car car1 = new Car(15.0, 30.0); car1 has can hold 15.0 gallons in tank. car1 can travel 30.0 miles per gallon. car1 holds 15.0 gallons to start. car1.getGallons();  return 15.0 possible = car1.canMakeTrip(120.0);  car1 needs 120.0/30.0 = 4.0 gallons. car1 has 15.0 gallons so it can make trip. updated value of gallons is 15.0 – 4.0 = 11.0 return true possible = carOne.canMakeTrip(600.0);  car1 needs 600.0/30.0 = 20.0 gallons car1 has 11.0 gallons so it cannot make trip. return false car1.addGas(100.0);  car1 has 11.0 gallons tank size is 15.0 gallons add 4.0 gallons updated value of gallons is 15.0 car1.getGallons();  return 15.0 possible = car1.canMakeTrip(150.0);  car1 needs 150.0 / 30.0 = 5.0 gallons car1 has 15.0 gallons so it can make trip updated value of gallons is 15.0 – 5.0 = 10.0  return true car1.addGas(2.0); car1 has 10.0 gallons tank size is 15.0 gallons updated value of gallons is 12.0 car1.getGallons();  return 12.0

Read Details

The nurse is educating on Mucinex (guaifenesin). Which state…

The nurse is educating on Mucinex (guaifenesin). Which statement by the nurse best describes the action of this medication?

Read Details

The health care provider prescribes a local application of N…

The health care provider prescribes a local application of Neo-Synephrine (phenylephrine) solution to treat a persistent epistaxis. What is the therapeutic effect of this medication?

Read Details

What does the Sherman Act target?

What does the Sherman Act target?

Read Details

The “con” side of a debate is also called the ______ side.

The “con” side of a debate is also called the ______ side.

Read Details

Pie charts are meant to show trends over time.

Pie charts are meant to show trends over time.

Read Details

Arrogance or unclear goals are behaviors that turn off inter…

Arrogance or unclear goals are behaviors that turn off interviewers.

Read Details

Answering questions ______ makes it possible for audience me…

Answering questions ______ makes it possible for audience members to remember how you answered a question.

Read Details

The final stage of Monroe’s Motivated Sequence is ______ whi…

The final stage of Monroe’s Motivated Sequence is ______ which involves telling your audience what you would like them to do.

Read Details

A(n) ______ requires an audience to choose between two polar…

A(n) ______ requires an audience to choose between two polar opposite options.

Read Details

Posts pagination

Newer posts 1 … 19 20 21 22 23 … 82,848 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top