In: Computer Science
write the following programs: Ram.java, Truck.java, LandVehicle.java and Vehicle.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
You did not tell what should be implemented, so built a basic functional program for the above classes.
Ram.java
public class Ram extends Truck {
      public Ram(String s) {
       super(s);
       // TODO Auto-generated constructor
stub
   }
   public static void main(String args[]){
          Vehicle v=new
Vehicle();
          v.drive();
          LandVehicle lv = new
LandVehicle();
          lv.LandDrive();
          lv.drive();
          Truck t = new
Truck("Hello");
      
          Ram r = new
Ram("Ram");
          r.drive();
          r.LandDrive();
      
}
}
Truck.java
public class Truck extends LandVehicle {
public Truck(String s) {
      System.out.println("Truck Driving "
+s);
} }
LandVehicle.java
public class LandVehicle extends Vehicle {
public void LandDrive() {
      System.out.println("Land Driving");
    // your implementation
}
}
Vehicle.java
public class Vehicle {
public void drive() {
      
System.out.println("Driving");
    // your implementation
}
}