given information, think carefully what is needed to be assigned to the super cl
ID: 3706989 • Letter: G
Question
given information, think carefully what is needed to be assigned to the super class and what should be assigned to the sub classes Question 3 Implement a program to store the applicant's information for a visa office. You need to implement the following: A super class called Applicant, which has the following instance variables: A variable to store first name of type String. A variable to store last name of type String. A variable to store date of birth, should be implemented as another class to store day, month and year A variable to store number of years working of type nteger A variable to store name of company where the applicant works. A variable to store average personal bank account balance for last six months of type double. The class should have the following methods: A constructor that sets the instance variables A set method for each instance variable -A get method for each instance variable A toString to display class information An applicant can be self employed or employed. For each type of applicants a sub class should be implemented. Self Employed that inherits from following instance variables: the super class and has the A variable to store capital of business of type double. A variable to store average Business bank account balance for the last six months. A variable to store number of employees in the business of type integer The class should have the following methods: . A constructor that sets the instance variables A set method for each instance variable .A get method for each instance variable A toString to display class information A sub class Employed that inherits from the super class and has the following instance variables: A variable to store salary of type double. A variable to store title of type String. The class should have the following methods: . A constructor that sets the instance variables A set method for each instance variable A get method for each instance variable A toString to display class informationExplanation / Answer
//This program illustrates the requirement for the supper class with the requirement implemented as required.This is //not compiled but can be used with some modification to cater the requirement.Only solution to question 3 is listed
//Date of birth class for storing the date of birth
public class DateofBirth {
int day;
int month;
int year;
}
//This is a super class to store the visa applicant data
public class Applicant{
String FirstName;
String LastName;
int NoofYearsWorking;
String NameofCompany;
double AvgAccountBalance;
Dateofbirth DOB;
public void setFirstName(String Fname) {
FirstName = FName;
}
public String getFirstName() {
return FirstName ;
}
public void setLastName(String Lname) {
LastName = LName;
}
public String getLasttName() {
return LastName ;
}
public void setNoofYearsWorking(int NoofYearsWorking) {
NoofYearsWorking = NoofYearsWorking;
}
public int getNoofYearsWorking() {
return NoofYearsWorking;
}
public void setNameofCompany(String NameofCompany) {
NameofCompany = NameofCompany;
}
public String getNameofCompany() {
return NameofCompany ;
}
public void setNoofYearsWorking(double AvgAccountBalance) {
AvgAccountBalance = AvgAccountBalance;
}
public double getNoofYearsWorking() {
return AvgAccountBalance;
}
public Applicant(String FName;String LName;int NoofYearsWork;String NameofComp;double AvgAccountBal; ADOB : Dateofbirth )
{
FirstName= Fname;
LastName = LName;
NoofYearsWorking = NoofYearsWork ;
NameofCompany = NameofComp;
AvgAccountBalance = AvgAccountBal;
DOB = new DateofBirth();
DOB.day = ADOB.day;
DOB.month = ADOB.month;
DOB.year = ADOB.month;
}
public String GetclassName()
{
return getClass().getName();
}
}
//Class extended from the Base class Applicant as per the requirement
public class SelfEmployed extends Applicant{
double BusCapital;
double AvgBusBankAcc;
int NoofEmloyess;
public void BusCapital(double BusCapital) {
BusCapital = BusCapital;
}
public double getBusCapital() {
return BusCapital;
}
public void AvgBusBankAcc(double AvgBusBankAcc) {
AvgBusBankAcc = AvgBusBankAcc;
}
public double AvgBusBankAcc() {
return AvgBusBankAcc;
}
public void setNoofEmloyess(int NoofEmloyess) {
NoofEmloyess = NoofEmloyess;
}
public int GetNoofEmloyess() {
return NoofEmloyess;
}
public SelfEmployed(double ABusCapital; double AAvgBusBankAcc; int ANoofEmloyess)
{
BusCapital = ABusCapital ;
AvgBusBankAcc = AAvgBusBankAcc ;
NoofEmloyess = ANoofEmloyess;
}
}
//Class extended from the Base class Applicant as per the requirement
public class Employed extends Applicant{
double Salary;
String Title;
public void Salary(double Salary) {
Salary = Salary;
}
public double getSalary() {
return Salary;
}
public void setTitle(String Title) {
Title = Title;
}
public String getTitle() {
return Title ;
}
public Employed(double ASalary; String ATitle)
{
Salary = ASalary ;
Title = ASalary ;
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.