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

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.
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.
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.
Output Example:
Your program should produce output similar to the following: (use your real
information for the name and ID)
BlueJ: Terminal Window - p-copy
Options
Setting the ID to: 12345101
Setting the name to: Ali
Setting the age to: 25
ID: 12345101
Name: Ali
Age: 25
Create a class named Person: Add the following

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!