Create a Person class conforming to the diagram above. A person is assigned an i
ID: 3791747 • Letter: C
Question
Create a Person class conforming to the diagram above. A person is assigned an immutable social security number at birth, and a name which can be changed later. People are born with an age of zero. The setAge method should set the person’s age. A senior citizen is someone over 65 years old.
Create a driver that asks the user, in a loop, for a person’s name, ssn, and age. You should create an instance of your Person class and print the new person to the console. You should stop when the user enters the word ”quit”.
Person ssn: String name: String age: int Person (ssn: String, name: String) getName(): String setName(name: String) set Age (age: int get Age(): int isSenior Citizen(): boolean toString StringExplanation / Answer
/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Person
{
Person(String a,String b, int c){
String ssn=a;
String name=b;
int age=c;
}
void setAge(int a){
int age=a;
//setting the age as a
}
void isSeniorCitizen(int a){
if(a>=65)
System.out.println("Senior Citizen");
else
System.out.println("Not a Senior Citizen");
}
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc= new Scanner(System.in);
while(sc.next()!="quit")
{
String Name=sc.next();
String Ssn=sc.next();
int Age=sc.nextInt();
}
Person id1= new Person("53222","32323",34);
id1.isSeniorCitizen();
}
}