Question: 1 . Create a class named Person: - Add the following instance variables: - id ( int ) : Stores a unique identifier for the

1. Create a class named Person:
- Add the following instance variables:
- id (int): Stores a unique identifier for the person.
- name (String): Stores the name of the person.
- age (int): Stores the age of the person.
2. Implement the following methods in the Person class:
- setId(int id): Assigns a value to the id variable.
- setName(String name): Assigns a value to the name variable.
- setAge(int age): Assigns a value to the age variable.
- getId(): Returns the value of id.
- getName(): Returns the value of name.
- getAge(): Returns the value of age.
3. Write a test program to demonstrate the Person class:
- Create an instance of the Person class.
- Use the setId, setName, and setAge methods to assign values to the instance.
- Use the getId, getName, and getAge methods to retrieve and print these values.
4. Output Example:
Your program should produce output similar to the following: (use your real information for the name and ID)
```
Ortion
Setting the ID to: 12345101
Setting the name to: Ali
Setting the age to: 25
ID: 12345101
Name: Ali
Age: 25
Can only enter input while your
```
5. Screenshots Required:
- Include a screenshot of your code.
- Include a screenshot of the program output after running the test program.
1 . Create a class named Person: - Add the

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 Programming Questions!