Starting from:
$30

$24

Homework Solution




**Considering the example of Java class hierarchy discussed in class, write the following programs: Ram.java, Truck.java, LandVehicle.java and Vehicle.java.**




Requirements




* Your Java class names must follow the names specified above. Note that they are case sensitive. See our template below.

* Class Ram contains a main method, which is the entrance of the program.

* Each class has to have its no-arg constructor. The behavior of the constructor is to print out a String. For example, class Truck's constructor will print "Truck's no-arg constructor is invoked.".

* Make sure your programs compile and submit your programs by following the submission instruction.




Program Template




```Java

public class Ram extends Truck {

public static void main(String[] args) {

// your implementation

}




public Ram() {

// your implementation

}

}




public class Truck extends LandVehicle {

public Truck() {

// your implementation

}




public Truck(String s) {

// your implementation

}

}




public class LandVehicle extends Vehicle {

public LandVehicle() {

// your implementation

}

}




public class Vehicle {

public Vehicle() {

// your implementation

}

}

```

More products