Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create all four fields. Then use the code generation from Eclipse to create the constructor and the toString method. Make the following change in class

Create all four fields. Then use the code generation from Eclipse to create the constructor and the toString method.

  • Make the following change in class toString: Use only the model to represent the car, not the toString method of class Car. (see Expected Output below)
  • In method fuelConsumption do the following: Calculate the amount of fuel that is required to travel from the departure to the destination and return the result in full precision (not rounded).
  • Doc Comments: Add doc comments for all classes, constructors, and public methods. Follow the style guidelines that were discussed in the practice video.

Car: Create the fields and use the code generation from Eclipse to create the constructor and the getters.

  • Doc Comments: Add doc comments for all classes, constructors, and public methods. Follow the style guidelines that were discussed in the practice video.

TravelApp: The class TravelApp is a test client and it includes the main method.

  • Create two cars:
    • m4: BMW M4 that uses 25 mpg
    • civic: Honda Civic that uses 42 mpg
  • Display the information of both cars in the following format: {make} {model} {mpg} mpg where {make}, {model}, and {mpg} are substituted by the values of the corresponding fields.
  • Create two trips:
    • California Trip: Drive from SF to LA, 382 miles, in your BMW M4
    • Florida Trip: Drive from Tampa to Miami, 280 miles, in your Honda Civic
  • Display information about the planned trips. For each of the trips, print the following:
    • A title so we know which trip we are describing
    • The string that is returned by the toString method
    • Information about fuel consumption in the following format: fuel consumption: {fuel consumption} gallons where {fuel consumption} is the fuel consumption of the whole trip, rounded to one digit after the decimal point.
  • Format the output as shown in the Expected Output below. Pay attention to titles and single empty lines to group related output.image text in transcribed
Trip Planner - departure : String - arrival : String - distance : int - car + Trip Planner(departure : String, arrival : String, distance: int, Car : car) + fuelConsumption(): double + toString(): String Car - make : String - model : String - mpg : int + Car ( make : String, model : String, mpg : int) + getMake(): String + getModel(): String + getMpg(): int

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2012 Administration

Authors: Adam Jorgensen, Steven Wort

1st Edition

1118106881, 9781118106884

More Books

Students also viewed these Databases questions

Question

LO1 Discuss four different views of motivation at work.

Answered: 1 week ago

Question

LO6 Summarize various ways to manage retention.

Answered: 1 week ago

Question

LO3 Define the difference between job satisfaction and engagement.

Answered: 1 week ago