Answer to Question #325903 in Java | JSP | JSF for janjan

Question #325903
  • ou must create a class named Bus.
  • You should also create a main class named Main.
  • In the Bus class, there should be member variables named:

   -length, capacity, speed (must be an integer)

   -fuel_capacity, fuel_burn_rate (must be a double) 

   -name, color (must be a string)

 

  • Create a constructor in the Bus class containing the parameters:

   -name

   -length

   -capacity

   -color

   -speed

   -fuel_capacity

   -fuel_burn_rate


1
Expert's answer
2022-04-08T16:06:09-0400
public class Main {
    public static void main(String[] args) {
    }
}
class Bus{
    int length, capacity, speed;
    double fuelCapacity, fuelBurnRate;
    String name, color;

    public Bus(int length, int capacity, int speed, double fuelCapacity, double fuelBurnRate, String name, String color) {
        this.length = length;
        this.capacity = capacity;
        this.speed = speed;
        this.fuelCapacity = fuelCapacity;
        this.fuelBurnRate = fuelBurnRate;
        this.name = name;
        this.color = color;
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS