Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Make a Java Program: 2. Make a class name Bus and make a main class name Main 3. In the Bus class, there should

1. Make a Java Program:

2. Make a class name Bus and make a main class name Main

3. In the Bus class, there should be member variables named:

-(integers) = length, capacity, speed

-(double) = fuel_capacity, fuel_burn_rate;

-(String) = name, color;

4. Make a constructor in the in the Bus class containing the parameters:

-name

-length

-capacity

-color

-speed

-fuel_capacity

-fuel_burn_rate

5. Make the following methods in the Bus class:

ComputeTravelHours

-*Must be a return method.

-*Must have a variable named result.

-*Must compute the estimated travel hour/s of a bus using the member variables fuel_capacity and fuel_burn_rate.

-*Returns the value of result.

ComputeGasUsedPerHour

-*Must be a void method.

-*Must have a variable named result1.

-*Must have a parameter named hours.

-*Must compute the gas used within the given hour/s using the member variables fuel_burn_rate and the variable hours located in our parameter.

-*Must print the value of result1. (e.g. "System.out.println("The gas used by metro within "+hours+"is "+result2);").

DisplayBusInfo

-*Must be a void method.

-*Must print the bus info (e.g. "System.out.println("Bus Name: "+ name +" Length: "+ length +" Capacity: "+ capacity +" Color: "+ color +" Speed: "+speed);").

6. In the Main class, there should be a main method.

7. Inside the main method, you should create two objects:

bachelor_express

-*You must pass the following values to this object: ("Bachelor Express", 20, 50, "Yellow", 150, 250, 5).

metro_shuttle

-*You must pass the following values to this object: ("Metro Shuttle", 15, 30, "Blue", 200, 200, 3).

8. Inside the main method, you must print the result of the method ComputeTravelHours for the two objects.

9. Also, inside the main method, you must access the method ComputeGasUsedPerHour with a parameter value of '3', which is an integer, to print its result using the two objects.

10. Lastly, inside the main method, you must access the method DisplayBusInfo to print its value using the two objects.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

Heres the Java program that implements the requirements you provided java class Bus private int length private int capacity private int speed private ... 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

Applied Regression Analysis And Other Multivariable Methods

Authors: David G. Kleinbaum, Lawrence L. Kupper, Azhar Nizam, Eli S. Rosenberg

5th Edition

1285051084, 978-1285963754, 128596375X, 978-1285051086

More Books

Students also viewed these Programming questions

Question

If y=tan-13/t^2 find dy/dt

Answered: 1 week ago

Question

Contemporary Tax Practice: Chapter 7

Answered: 1 week ago

Question

high proportion of women enrolled in universities

Answered: 1 week ago

Question

low proportion of Muslims

Answered: 1 week ago