Question: Write a program called HomeworkSSNPerson.java - which does the following things Extends the Person class to add a String field / attribute called SSN -

Write a program called HomeworkSSNPerson.java - which does the following things
Extends the Person class to add a String field/attribute called SSN - represents social security number
Social security number strings are of the form x-- where x is any digit from 0 through 9
In the Person class - extend the equals() method to say that two Person objects are to be considered equal if and only if their SSN Strings are identical
Extend the Person class method toString() to also label and display the SSN field
Extend the Person class method compareTo() so that it compares Person object by the scheme below:
If lastName fields differ and are in any String order - let that be the order of the Person objects, else
If firstName fields differ and are in any String order - let that be the order of the Person objects, else
Let the String order of the Scsiv field decide the order of the two Person objects
Write a main() method to test the ordering -
Using a Scanner on
System.in, read in two comma-separated lines of the form
firstName,lastName,age,xxx-xx-xxxx
as in: Mary,Smith,28,123-45-5678
Read these in and convert each line of input to one Person object (call the Person constructor on the split-out elements of the input line)
Then compare the two Person objects using the Person compareTo() method
Then print out both Person objects (with their toString() method) with an indication of which precedes which in the order; you might print one of the following:
person1 precedes person 2
person2 precedes person 1
person1 equals person 2
You have been provided a file HomeworkSSNPerson.zip on our class Canvas page - Module 1- pull out of that a template file for HomeworkSSNPerson.java. Do this program by filling in the template code!!
Make sure your program reads in just two lines of input text and then goes on to do the task! Do not vary from this - our grading tools will grade based on this. Don't lose points by not following the directions.
AGAIN - FOLLOW THE TEMPLATE EXACTLY!!
Put a multiline block header comment at the top of your program - with your name, the date, the name of the program, and brief explanation of what it does.
.0. REMEMBER: follow the template and make sure your program and its public class are named HomeworkSSNPerson - and make sure it reads in and then processes two comma separated lines and nothing more!
Test your program thoroughly - with various pairs of comma-separated lines - at least one case where the last names differ, one case where the last names are identical but first names differ, and one case where first and last names are identical - but SSNs differ!!
 Write a program called HomeworkSSNPerson.java - which does the following things

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!