Question
Java
Question 3 Implement a program to store the applicants 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 integer 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 the super class and has the following instance variables: 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 A constructor that sets the instance variables A get method for each instance variable The class should have the following methods: .A set 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 information
0 0
Add a comment Improve this question Transcribed image text
Answer #1

/* below is the complete code and all the classes

*/

package learning;

public class Applicant {
String firstName;
String lastName;
int numberOfyear;
String companyName;
DateOfBirth dob;
double averageLastSixthMonBalance;

public Applicant(String firstName, String lastName, int numberOfyear,String companyName, DateOfBirth dob, double averageLastSixthMonBalance ){
  this.firstName = firstName;
  this.lastName = lastName;
  this.numberOfyear = numberOfyear;
  this.companyName = companyName;
  this.dob = dob;
  this.averageLastSixthMonBalance = averageLastSixthMonBalance;
}

public String getFirstName() {
  return firstName;
}

public void setFirstName(String firstName) {
  this.firstName = firstName;
}

public String getLastName() {
  return lastName;
}

public void setLastName(String lastName) {
  this.lastName = lastName;
}

public int getNumberOfyear() {
  return numberOfyear;
}

public void setNumberOfyear(int numberOfyear) {
  this.numberOfyear = numberOfyear;
}

public String getCompanyName() {
  return companyName;
}

public void setCompanyName(String companyName) {
  this.companyName = companyName;
}

public DateOfBirth getDob() {
  return dob;
}

public void setDob(DateOfBirth dob) {
  this.dob = dob;
}

public double getAverageLastSixthMonBalance() {
  return averageLastSixthMonBalance;
}

public void setAverageLastSixthMonBalance(double averageLastSixthMonBalance) {
  this.averageLastSixthMonBalance = averageLastSixthMonBalance;
}

public String toString(){
  return "Applicant:[ firstName: " + firstName + " , lastName: " + lastName + ", numberOfyear: " + numberOfyear + ", companyName: " + companyName + ", dob: " + dob + ",averageLastSixthMonBalance: " + averageLastSixthMonBalance;
}
}

class SelfEmployed extends Applicant{
double businessCapital;
double averageLastBusinessBankAccount;
int numberOfEmployee;

public double getBusinessCapital() {
  return businessCapital;
}

public void setBusinessCapital(double businessCapital) {
  this.businessCapital = businessCapital;
}

public double getAverageLastBusinessBankAccount() {
  return averageLastBusinessBankAccount;
}

public void setAverageLastBusinessBankAccount(
   double averageLastBusinessBankAccount) {
  this.averageLastBusinessBankAccount = averageLastBusinessBankAccount;
}

public int getNumberOfEmployee() {
  return numberOfEmployee;
}

public void setNumberOfEmployee(int numberOfEmployee) {
  this.numberOfEmployee = numberOfEmployee;
}

public SelfEmployed(double businessCapital, double averageLastBusinessBankAccount, int numberOfEmployee, String firstName, String lastName, int numberOfyear,String companyName, DateOfBirth dob, double averageLastSixthMonBalance){
  super(firstName,lastName,numberOfyear,companyName,dob,averageLastSixthMonBalance);
  this.businessCapital = businessCapital;
  this.averageLastBusinessBankAccount = averageLastBusinessBankAccount;
  this.numberOfEmployee = numberOfEmployee;
}

public String toString(){
  return "SelfEmployed:[ firstName: " + firstName + " , lastName: " + lastName + ", numberOfyear: " + numberOfyear + ", companyName: " + companyName + ", dob: " + dob + ",averageLastSixthMonBalance: " + averageLastSixthMonBalance + ", businessCapital: " + businessCapital + ", averageLastBusinessBankAccount: " + averageLastBusinessBankAccount + " ,numberOfEmployee: " + numberOfEmployee;
}
}

class Employed extends Applicant{
double salary;
String title;

public double getSalary() {
  return salary;
}

public void setSalary(double salary) {
  this.salary = salary;
}

public String getTitle() {
  return title;
}

public void setTitle(String title) {
  this.title = title;
}


public Employed(double salary, String title, String firstName, String lastName, int numberOfyear,String companyName, DateOfBirth dob, double averageLastSixthMonBalance){
  super(firstName,lastName,numberOfyear,companyName,dob,averageLastSixthMonBalance);
  this.salary = salary;
  this.title = title;
}

public String toString(){
  return "Employed:[ firstName: " + firstName + " , lastName: " + lastName + ", numberOfyear: " + numberOfyear + ", companyName: " + companyName + ", dob: " + dob + ",averageLastSixthMonBalance: " + averageLastSixthMonBalance + ", salary: " + salary + ", title: " + title;
}
}


class DateOfBirth {
int day;
int month;
int year;

public DateOfBirth(int day, int month, int year){
  this.day = day;
  this.month = month;
  this.year = year;
}
public String toString(){
  return day + "/" + month + "/" + year;
}
}

Add a comment
Know the answer?
Add Answer to:
Java Question 3 Implement a program to store the applicant's information for a visa office. You...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • JAVA... QUESTION 3 IS A CONTINOUS TO Q2 CAN YOU SEND THE CODE SEPARATELY FOR EACH...

    JAVA... QUESTION 3 IS A CONTINOUS TO Q2 CAN YOU SEND THE CODE SEPARATELY FOR EACH Q , I BE SO THANKFUL Q2. 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...

  • Here is a sample run of the tester program: Make sure your program follows the Java...

    Here is a sample run of the tester program: Make sure your program follows the Java Coding Guidelines. Consider the following class: /** * A store superclass with a Name and Sales Tax Rate */ public class Store {      public final double SALES_TAX_RATE = 0.06;      private String name;           /**      * Constructor to create a new store      * @param newName      */      public Store(String newName)      {           name = newName;      }     ...

  • Java Program (PLEASE PROVIDE SCREENSHOT OF THE CODE) Create a class Person which is a super...

    Java Program (PLEASE PROVIDE SCREENSHOT OF THE CODE) Create a class Person which is a super class. The class includes four private String instance variables: first name, last name, social security number, and state. Write a constructor and get methods for each instance variable. Also, add a toString method to print the details of the person. After that create a class Teacher which extends the class, Person. Add a private instance variable to store number of courses. Write a constructor...

  • C# programming 50 pts Question 2:2 1- Create the base class Book that has the following instance variables, constructor, and methods title (String) isbn (String) authors (String) publisher (Strin...

    C# programming 50 pts Question 2:2 1- Create the base class Book that has the following instance variables, constructor, and methods title (String) isbn (String) authors (String) publisher (String) edition ( int) published year (int) Constructor that takes all of the above variables as input parameters. set/get methods ToString method// that return sting representation of Book object. 2-Create the sub class New_Book that is derived from the base class Book and has the following instance variables, constructor, and methods: title...

  • JAVA QUESTION 16 Write and submit the java source for the following class specification: The name...

    JAVA QUESTION 16 Write and submit the java source for the following class specification: The name of the class is Question_16 Class Question_16 has 3 instance variables: name of type String, age of type int and height of type double. Class Question_16 has the following methods: print - outputs the data values stored in the instance variables with the appropriate label setName - method to set the name setAge - method to set the age setHeight - method to set...

  • Implement a Java class that is called RainFall that uses a double array to store the...

    Implement a Java class that is called RainFall that uses a double array to store the amount of rainfall for each month of the year. The class should have only one instance variable of type double[]. Implement the following methods in the RainFall class: 1. A constructor that creates and initializes all entries in the array to be -1. 2. toString: a method that returns a one-line String representation of the object that includes 12 double numbers that represent the...

  • JAVA :The following are descriptions of classes that you will create. Think of these as service...

    JAVA :The following are descriptions of classes that you will create. Think of these as service providers. They provide a service to who ever want to use them. You will also write a TestClass with a main() method that fully exercises the classes that you create. To exercise a class, make some instances of the class, and call the methods of the class using these objects. Paste in the output from the test program that demonstrates your classes’ functionality. Testing...

  • Java 1. Develop a program to emulate a purchase transaction at a retail store. This program...

    Java 1. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual line item of merchandise that a customer is purchasing. The Transaction class will combine several LineItem objects and calculate an overall total price for the line item within the transaction. There will also be two test classes, one for the LineItem class and one for the...

  • Hello. I need help writing the following Java Program. Thank you Develop a class encapsulating the...

    Hello. I need help writing the following Java Program. Thank you Develop a class encapsulating the concept of a college course, assuming that a course has following attributers: code (for instance COSC1337), a description, and a number of credits (for instance 3). Include a constructor, the accessors, mutators and methods ‘toString’, ‘equals’, and ‘finalize’. Write a client class to test the behavior of the class and its methods. The outline of the class is given as follows: public class Course...

  • Java file Name Dog Classes and Methods Create a constructor that incorporates the type, breed, and...

    Java file Name Dog Classes and Methods Create a constructor that incorporates the type, breed, and name variables (do not include topTrick). Note: The type refers to what the breed typically does; for example, a corgi would be a “cattle herding dog.” A Shiba Inu would be a “hunting dog.” Create the setTopTrick() mutator method Dog is parent class Corgi and Driver are subclasses Complete the Corgi class: Using the UML Class diagram, declare the instance variables. Create the two...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT