Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For this assignment, we will load an existing class and create objects based on the class and display the generated results from this object. Create
For this assignment, we will load an existing class and create objects based on the class and display the generated results from this object.
- Create a New Project in Eclipse
- Create a class in this project named SocialSecurityNumber. It is important is it spelled exactly as shown.
- Open the attached text about and copy/replace this text into the class created in Step 2. Eclipse should not display any errors in the class.
- Create a new class in the project. You can choose any name you wish. You may want Eclipse to generate a main method for you.
- In the main() method, create an object that is an instance of the SocialSecurityNumber class. In it's constructor, pass a string that is your first name. The variable name can be of your choosing.
- SocialSecurityNumber mySSNTest1= new SocialSecurityNumber("myFirstName");
- Referring to the the variable name created in Step 5, display the result of the isValid method.
- Using System.out.println, display the object's data via the toString method.
- Create a 2nd instance of the SocialSecurityNumber class and give it an different variable name than the one done in Step 5. For it's constructor, pass it literal string of 9 digits.DO NOT USE THE EXAMPLE DATA below. You can pass a 9 digit string that does not include the "-" formatting.
- SocialSecurityNumber mySSNTest2= new SocialSecurityNumber("123-45-6789");
- Code your program to call and display the results of the following methods for the variable created in Step 8. Do not directly or indirectly call the toString method.
- isValid()
- getSocialSecurityInt()
- getSocialSecurityStringFormatted()
- Using System.out.println, display the object's data via the toString method.
Deliverable is the coded .Java program source code.
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