Question: Add the following instance variables: id ( int ) : Stores a unique identifier for the person. - name ( String ) : Stores the
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:
setldint id: Assigns a value to the id variable.
setNameString name: Assigns a value to the name variable.
setAgeint age: Assigns a value to the age variable.
getld: 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 setld, setName, and setAge methods to assign values to the instance. circ Use the getld, 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
A Blue:: Terminal Window pcopy
Options
Setting the ID to:
Setting the name to: Ali
Setting the age to:
ID:
Name: Ali
Age:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
