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:
- 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.
- 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.
- Write appropriate mutator methods that store values in these fields.
- Write accessor methods that return the values of the fields.
- Write a toString() method that returns a String containing all the information about the person written on separate lines.
- Once the Person class is written, create a separate program that creates three Person objects, instantiated with each of the constructors.
- Display the three objects using toString method once they were created
- 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 - Display the tree objects after you update their values.
- Download the template file, Person.txt, and save it as Person.java
- Download the template file, PersonDriver.txt, and save it as PersonDriver.java
- 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
Get step-by-step solutions from verified subject matter experts
