Solution for QID #8982: publicclassVehicle { publicStringmanfacname; publicint | StudyHelpMe

Subject: Computer Science
Status: Verified Solution
public class Vehicle { public String manfacname; public int cylinders; public Person owner;   public Vehicle() {   }   public Vehicle(String str, int num) { manfacname = str; cylinders = num; }   public void drivedBy(String name) { owner = new Person(); owner.setName(name); }   }     public class Person { String name;   public Person() { name = "No name yet"; }   public Person(String initialName) { name = initialName; }   public void setName(String newName) { name = newName; }   public String getName() { return name; }   public void writeOutput() { System.out.println("Name: " + name); }   public boolean hasSameName(Person otherPerson) { return this.name.equalsIgnoreCase(otherPerson.name); } }     public class Truck extends Vehicle{ public double loadcapacity; public double towingcapacity;   public Truck(double load, double town) { loadcapacity = load; towingcapacity = town; }   public String checkLoad() { if (loadcapacity > 1000) { return "Too much load"; } else return "You can carry"; }   public boolean move() { if (checkLoad().equals("Too much load")) { return false; } else return true;   }   }     public class Driver { Vehicle veh; Truck tr;   public Driver(String name, double load, double tow) { tr = new Truck(load, tow); veh = new Vehicle(); veh.drivedBy(name); tr.checkLoad(); if (tr.move()) System.out.println(veh.owner.getName() + " can drive the truck"); else System.out.println(veh.owner.getName() + " can't drive the truck");}public static void main(String args[]) {new Driver("Ali", 800, 800);}}
ZERO AI
Human Written
PHD EXPERTS
Verified
TURNITIN
Clean Report
FAST DELIVERY
Instant/Hourly