nstructions JobApplicant.ja... TestjobApplica...+ 1 public class JobApplicant (
ID: 3745989 • Letter: N
Question
nstructions JobApplicant.ja... TestjobApplica...+ 1 public class JobApplicant ( 2private String name; 3 private string phone; Create a class in JobApplicant.java that holds data about a job applicant. Include a name, a phone number, and four Boolean fields that private boolean hasHordsktl, boolean hasSpreadsheetskill; represent whether the applicant is skilled in each of the following areas: word processing spreadsheets, databases, and graphics. Include a constructor that accepts values for each of the fields. Also include a get method for each field. The get method should be the field name prefixed with 'get'. For example, the get method for nane should be called getNane . 6 private boolean hasDatabasesktll; 7private boolean hasGraphicsskill; public JobApplicant(string nane, String phone boolean d, boolean g) ( 10 public String getNane() f Create an application in TestjobApplicants.java that instantiates several job applicant objects and pass each in turn to a Boolean method named isQualifted that determines whether each applicant is qualified for an interview. 12 public string getPhone() ( 13 14 public boolean getHasHordskill) 15 16 public boolean getHasSpreadsheetsktllo ( 17) 18 public boolean getHasDatabaseskillo ( 19 20 public boolean getHasGraphicsskill [ Then, in the natn() method, display an appropriate method for each applicant. A qualified applicant has at least three of the four skillsExplanation / Answer
class JobApplicant
{
private String name;
private String phone;
private boolean hasWordSkill;
private boolean hasSpreadSheetSkill;
private boolean hasDatabaseSkill;
private boolean hasGraphicsSkill;
public JobApplicant(String name,String phone,boolean w,boolean s,boolean d,boolean g)
{
this.name = name;
this.phone = phone;
hasWordSkill = w;
hasSpreadSheetSkill = s;
hasDatabaseSkill = d;
hasGraphicsSkill = g;
}
public String getName()
{
return name;
}
public String getPhone()
{
return phone;
}
public boolean getHasWordSkill()
{
return hasWordSkill;
}
public boolean getSpreadSheetSkill()
{
return hasSpreadSheetSkill;
}
public boolean getHasDatabaseSkill()
{
return hasDatabaseSkill;
}
public boolean getHasGraphicsSkill()
{
return hasGraphicsSkill;
}
public boolean isQualified()// have at least 3 skills
{
if(hasWordSkill && hasSpreadSheetSkill && hasDatabaseSkill ||
hasSpreadSheetSkill && hasDatabaseSkill && hasGraphicsSkill ||
hasWordSkill && hasDatabaseSkill && hasGraphicsSkill ||
hasWordSkill && hasSpreadSheetSkill && hasGraphicsSkill ||
hasWordSkill && hasSpreadSheetSkill && hasDatabaseSkill && hasGraphicsSkill)
return true;
else
return false;
}
}
class TestJobApplicants
{
public static void main (String[] args)
{
JobApplicant j1 = new JobApplicant("Andy James","0123-97878",true,false,true,true);
System.out.println(j1.getName() +" is qualified : "+j1.isQualified());
JobApplicant j2 = new JobApplicant("Bobby Rodgers","8687-7787",true,false,false,true);
System.out.println(j2.getName() +" is qualified : "+j2.isQualified());
JobApplicant j3 = new JobApplicant("Candy","5465-7686",false,false,true,true);
System.out.println(j3.getName() +" is qualified : "+j3.isQualified());
JobApplicant j4 = new JobApplicant("Donald" ,"546-86868",true,true,true,true);
System.out.println(j4.getName() +" is qualified : "+j4.isQualified());
JobApplicant j5 = new JobApplicant("Eve Jones","6575-8699",true,true,true,false);
System.out.println(j5.getName() +" is qualified : "+j5.isQualified());
}
}
Output:
Andy James is qualified : true
Bobby Rodgers is qualified : false
Candy is qualified : false
Donald is qualified : true
Eve Jones is qualified : true
Do ask if any doubt. Please upvote.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.