🔒 Closed Java

Status
Not open for further replies.

S U B T L E

Forum Guru
Sana po may maka tulong salamat.

1. You must create a class named Bus.
2. You should also create a main class named 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. Create a constructor in the Bus class containing the parameters:
-name
-length
-capacity
-color
-speed
-fuel_capacity
-fuel_burn_rate

5. Create 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 +"\n Length: "+ length +"\n Capacity: "+ capacity +"\n Color: "+ color +"\n 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 E×ρréšš", 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
 
Status
Not open for further replies.

About this Thread

  • 1
    Replies
  • 403
    Views
  • 2
    Participants
Last reply from:
LadyClare

Online now

Members online
950
Guests online
882
Total visitors
1,832

Forum statistics

Threads
2,276,241
Posts
28,968,601
Members
1,231,180
Latest member
lumb
Back
Top