Question: Guided Assignment Problem 2: Person Class To solve this problem, you should know objects, classes, and the entire design process of a class. For this

Guided Assignment Problem 2: Person Class

To solve this problem, you should know objects, classes, and the entire design process of a class.

For this problem, you will create a class, Person, and demonstrate the class's methods through a driver class, which contains the main method.

Your Tasks:

Please follow the steps to complete this guided assignment:

  1. Write a class Person.java, that has the following fields:
    • name- The name field references a String object that holds the persons name.
    • idNumber- The idNumber is an integer that holds the employee ID number.
    • department- The department field references a String object that holds the name of the department where the employee works.
  2. The class should have the following constructors:
    • A constructor that accepts the listed values as arguments and assigns them to the appropriate fields as the following, employees name, employees ID number, and department.
    • A constructor that accepts the listed values as arguments and assigns them to the appropriate fields as the following, employees name and ID number. The department field should be assigned an empty string ("").
    • A no-arg constructor that assigns empty strings ("") to the name, as well as department, and 0 to the idNumber field.
  3. Write appropriate mutator methods that store values in these fields.
  4. Write accessor methods that return the values of the fields.
  5. Write a toString() method that returns a String containing all the information about the person written on separate lines.
  6. Once the Person class is written, create a separate program that creates three Person objects, instantiated with each of the constructors.
  7. Display the three objects using toString method once they were created
  8. For the objects that are created with constructors that have empty values, and zero, use mutator methods to change the values according to the following data:
    Name ID Number Department
    Jimmy Dean 23123 Sales
    Jane Young 32421 Marketing
    Ella Jones 54231 IT
  9. Display the tree objects after you update their values.
  10. Download the template file, Person.txt, and save it as Person.java
  11. Download the template file, PersonDriver.txt, and save it as PersonDriver.java
  12. Go through the files and identify the tasks you have to fulfill, which are clearly marked throughout the file. Complete all the required tasks.

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!