Question: Please help me write these Java classes. We are using the latest version of Java. Please post screenshots of your code and output since it

Please help me write these Java classes. We are using the latest version of Java. Please post screenshots of your code and output since it is easier to see the format that way.

Please help me write these Java classes. We are using the latestversion of Java. Please post screenshots of your code and output since

Create a class called Vehicle that has a manufacturer's name (type String), a number of cylinders in the engine (type int), and an owner (type Person given below). Then, create a class called Truck that is a derived class from the Vehicle class and has additional properties such as a load capac ity in tons (type double since it may contain a fractional part) and a towing capacity in pounds (type int). Be sure that your class has appropriate constructors, accessors, mutators, equals, and toString methods. The definition of the class Person is below. Complete the definitions of the methods. public class Person private String name; public Person public Person (String theName) ) public String getName ) ) public void setName (String theName) C ) public String toString)f... public boolean equals (Object other) .. ) The following presents a sample test program. If there's an error in the program, fix the error. public class Lab7Demo ( public static void main(Stringl] args) Person pinew Person System.out.println("p1: "pl); p1.setName("Bob"); System. out.println ("p1's name is: "p1.getName; Person p2 new Person("Joe"); System.out.println("p2:" p2)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!