In Java Programming: Example, 8-8, defined the class Person to store the name of a person. The methods that we included merely set the name and  print the name of a person. Redefine the class Person so that, in addition to what the existing class does, ypu can: 1. Set the last name only. 2. Set the first name only. 3 Set the middle name. 4. Check whether a given last name is the same as the last name of this person. 5. Check wether a given first name is the same as the first name of this person. 6. Check whether a given middle name is the same as the middle name of thi person. 7. Add the method equals that returns true if two objects contain the same first, middle, and last name. 8. Add the method makeCopy that copies the instance variables of a Person object into another Person object. 9. Add the method getCopy that creates and returns the address of the object, which is a copy of another Person object. 10. Add a copy constructor. 11. Write the definitions of the methods of the class Person to implement the operations for this class. 12. Write a progrsm that tests various operations pf the class Person.   Here's Example 8-8 of the Person Class: public class Person   private String firstName, private String lastName   //Default Constructor pubic Person() {firstName = " " ; lastName = "  "; } //Construcotr with parameters public Person(String first, String last) { setName(first, last); }   //Method to output the first name and last name public String toString() { return (firstName + " " + lastName); } //method to set first name and last name public void setName(String first, String last) { firstName = first; lastName  last; } //Method to return the firstName public String getFirstName() { return firstName; } //Method to return the lastName public String getLastNme() { return lastName; }

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

In Java Programming: Example, 8-8, defined the class Person to store the name of a person. The methods that we included merely set the name and  print the name of a person. Redefine the class Person so that, in addition to what the existing class does, ypu can:

1. Set the last name only.

2. Set the first name only.

3 Set the middle name.

4. Check whether a given last name is the same as the last name of this person.

5. Check wether a given first name is the same as the first name of this person.

6. Check whether a given middle name is the same as the middle name of thi person.

7. Add the method equals that returns true if two objects contain the same first, middle, and last name.

8. Add the method makeCopy that copies the instance variables of a Person object into another Person object.

9. Add the method getCopy that creates and returns the address of the object, which is a copy of another Person object.

10. Add a copy constructor.

11. Write the definitions of the methods of the class Person to implement the operations for this class.

12. Write a progrsm that tests various operations pf the class Person.

 

Here's Example 8-8 of the Person Class:

public class Person

 

private String firstName,

private String lastName

 

//Default Constructor

pubic Person()

{firstName = " " ;

lastName = "  ";

}

//Construcotr with parameters

public Person(String first, String last)

{

setName(first, last);

}

 

//Method to output the first name and last name

public String toString()

{

return (firstName + " " + lastName);

}

//method to set first name and last name

public void setName(String first, String last)

{

firstName = first;

lastName  last;

}

//Method to return the firstName

public String getFirstName()

{

return firstName;

}

//Method to return the lastName

public String getLastNme()

{

return lastName;

}

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education