Question: Create a base class called Vehicle that has the manufacturer's name (type String), number of cylinders in the engine (type int), and owner (type Person
Listing 8.1
Person Class
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);
}
}
Step by Step Solution
3.39 Rating (165 Votes )
There are 3 Steps involved in it
public class Vehicle public String manfacname public int cylinders public Person owner public Vehicl... View full answer
Get step-by-step solutions from verified subject matter experts
Document Format (1 attachment)
1013-C-S-O-S (710).docx
120 KBs Word File
