Answered step by step
Verified Expert Solution
Link Copied!

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.

  1. Create a New Project in Eclipse
  2. Create a class in this project named SocialSecurityNumber. It is important is it spelled exactly as shown.
  3. 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.
  4. 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.
  5. 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.
    1. SocialSecurityNumber mySSNTest1= new SocialSecurityNumber("myFirstName");
  6. Referring to the the variable name created in Step 5, display the result of the isValid method.
  7. Using System.out.println, display the object's data via the toString method.
  8. 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.
    1. SocialSecurityNumber mySSNTest2= new SocialSecurityNumber("123-45-6789");
  9. 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.
    1. isValid()
    2. getSocialSecurityInt()
    3. getSocialSecurityStringFormatted()
  10. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Were the right people involved in the decision-making process?

Answered: 1 week ago