(Solved) : Need Work Persondriverjava Created Personjava Please Use Solve Persondriverjava Code Must Q41354691 . . .

ISLAVE.dvd SW public class Person { 26 private String firstName; private String lastName; private int age; 27 29e public Pers71 72 A73e public String toString() { 74 return firstName++lastName +,++age +years old; 75} 76 77e public boolean equPart 1 Write the Java code from the Person class created in the pre-lab. Write a driver (test) program named PersonDriver thao Sue Smith, 32 years old are the same age If the first is older than the second Sue Smith, 36 years old is older George Smit
You only need to work on PersonDriver.java. I have created thePerson.java; Please use it to solve PersonDriver.java.
Your code must be in java form.ISLAVE.dvd SW public class Person { 26 private String firstName; private String lastName; private int age; 27 29e public Person() { this.firstName – firstName; 0.31 this.lastName= lastName; this.age – age; 33 } 34 37e public String getFirstName() { return firstName; 39} 38 42 43e public void setFirstName(String firstName) { this.firstName – firstName; 45 } 47 48 49e public String getLastName() { 50 return lastName; 51 ) 52 54 55e public void setLastName(String lastName) { 56 this.lastName = lastName; 57 58 59 61e public int getAge() { 62 return age; 63 } 71 72 A73e public String toString() { 74 return firstName+””+lastName +”,”+””+age +”years old”; 75} 76 77e public boolean equals(Person P) { 78 if(this.firstName.equals(P.getFirstName())&&this.lastName.equals(P.getLastName())) { 79 return true; 80 else 81 return false; 86 87 88 89 90 Part 1 Write the Java code from the Person class created in the pre-lab. Write a driver (test) program named PersonDriver that does the following • Gets a first name, last name, and age from the user • Creates a Person object using that data • Gets another first name, last name, and age from the user • Creates a second Person object using that data Uses the equals method to determine if the two objects have the same name. Messages need to use the toString method to print the values of each object with the appropriate messages as follows. The toString should print the values of the instance variables in the form: firstName lastName, age years old. For example: Sue Smith who is 32 should print: Sue Smith, 32 years old o If they have the same name print: Sue Smith, 32 years old and Sue Smith, 32 years old have the same name • If they have different names print: Sue Smith, 32 years old and George Smith, 34 years old have different names Determines whether the two people represented by the two objects are the same age or indicates whether the first one is older or younger than the second one. Messages need to use the toString method to print the values of each object with the appropriate messages as follows: o If they are the same age Sue Smith, 32 years old and o Sue Smith, 32 years old are the same age If the first is older than the second Sue Smith, 36 years old is older George Smith, 34 years old • If the first is younger than the second Sue Smith, 32 years old is younger George Smith, 34 years old Run the program several times with varying test cases to determine that it works correctly in all cases. Show transcribed image text ISLAVE.dvd SW public class Person { 26 private String firstName; private String lastName; private int age; 27 29e public Person() { this.firstName – firstName; 0.31 this.lastName= lastName; this.age – age; 33 } 34 37e public String getFirstName() { return firstName; 39} 38 42 43e public void setFirstName(String firstName) { this.firstName – firstName; 45 } 47 48 49e public String getLastName() { 50 return lastName; 51 ) 52 54 55e public void setLastName(String lastName) { 56 this.lastName = lastName; 57 58 59 61e public int getAge() { 62 return age; 63 }
71 72 A73e public String toString() { 74 return firstName+””+lastName +”,”+””+age +”years old”; 75} 76 77e public boolean equals(Person P) { 78 if(this.firstName.equals(P.getFirstName())&&this.lastName.equals(P.getLastName())) { 79 return true; 80 else 81 return false; 86 87 88 89 90
Part 1 Write the Java code from the Person class created in the pre-lab. Write a driver (test) program named PersonDriver that does the following • Gets a first name, last name, and age from the user • Creates a Person object using that data • Gets another first name, last name, and age from the user • Creates a second Person object using that data Uses the equals method to determine if the two objects have the same name. Messages need to use the toString method to print the values of each object with the appropriate messages as follows. The toString should print the values of the instance variables in the form: firstName lastName, age years old. For example: Sue Smith who is 32 should print: Sue Smith, 32 years old o If they have the same name print: Sue Smith, 32 years old and Sue Smith, 32 years old have the same name • If they have different names print: Sue Smith, 32 years old and George Smith, 34 years old have different names Determines whether the two people represented by the two objects are the same age or indicates whether the first one is older or younger than the second one. Messages need to use the toString method to print the values of each object with the appropriate messages as follows: o If they are the same age Sue Smith, 32 years old and
o Sue Smith, 32 years old are the same age If the first is older than the second Sue Smith, 36 years old is older George Smith, 34 years old • If the first is younger than the second Sue Smith, 32 years old is younger George Smith, 34 years old Run the program several times with varying test cases to determine that it works correctly in all cases.

Expert Answer


Answer to You only need to work on PersonDriver.java. I have created the Person.java; Please use it to solve PersonDriver.java. Yo…