Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need help with my Person Class PLEASE provide corrected codes if possible. My code: public class Person { private String name; private boolean hasDriverLicense;
I need help with my Person Class
PLEASE provide corrected codes if possible.
My code:
public class Person
private String name;
private boolean hasDriverLicense;
private int age;
private int height;
public PersonString name, boolean hasDriverLicense, int age, int height
this.name name;
this.hasDriverLicense hasDriverLicense;
this.age age;
this.height height;
public String getName
return name;
public boolean hasDriverLicense
return hasDriverLicense;
public int getAge
return age;
public int getHeight
return height;
public Person clone
return new Personname hasDriverLicense, age, height;
@Override
public boolean equalsObject o
if this o return true;
if o null getClass ogetClass return false;
Person person Person o;
return hasDriverLicense person.hasDriverLicense &&
age person.age &&
height person.height &&
name.equalspersonname;
@Override
public String toString
return String.formatPerson names aged heightd has licenses
name, age, height, hasDriverLicense "license" : no license";
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started