Bottom section is the what they expect in the code in java Create a class in Job
ID: 3745706 • Letter: B
Question
Bottom section is the what they expect in the code in java
Create a class in JobApplicant.java that holds data about a job applicant. Include a name, a phone number, and four Boolean fields that 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 name should be called getName. Create an application in TestJobApplicants.java that instantiates several job applicant objects and pass each in turn to a Boolean method named isQualified that determines whether each applicant is qualified for an interview. Then, in the main() method, display an appropriate method for each applicant. A qualified applicant has at least three of the four skills. Grading Write your Java code in the area on the right. Use the Run button to compile and run the code. Clicking the Run Checks button will run pre-configured tests against your code to calculate a grade. Once you are happy with your results, click the Submit button to record your score.
public 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) {
}
public String getName() {
}
public String getPhone() {
}
public boolean getHasWordSkill() {
}
public boolean getHasSpreadsheetSkill() {
}
public boolean getHasDatabaseSkill() {
}
public boolean getHasGraphicsSkill() {
}
}
Explanation / Answer
Please follow the step by step instructions to get the exact output without any confusion.
Step1: Create a java class file named JobApplicant.java
Code as:
JobApplicant.java
public 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) //constructor to initialize values
{
this.name=name;
this.phone=phone;
hasWordSkill=w;
hasSpreadsheetSkill=s;
hasDatabaseSkill=d;
hasGraphicsSkill=g;
}
//get methods, name and phone of applicant
public String getName()
{
return name;
}
public String getPhone()
{
return phone;
}
public boolean getHasWordSkill()
{
return hasWordSkill;
}
public boolean getHasSpreadSheetSkill()
{
return hasSpreadsheetSkill;
}
public boolean getHasDatabaseSkill()
{
return hasDatabaseSkill;
}
public boolean getHasGraphicsSkill()
{
return hasGraphicsSkill;
}
} //end of class JobApplicant
Step2: Now create a java class file named TestJobApplicant.java
Code as:
TestJobApplicant.java
public class TestJobApplicant{
public static void main(String[] args){
JobApplicant app1 = new JobApplicant("Peter", "123-124-4534",true,false,true,false);
JobApplicant app2 = new JobApplicant("John", "123-125-4534",true,false,true,true);
JobApplicant app3 = new JobApplicant("Kate", "123-126-4534",true,false,false,true);
JobApplicant app4 = new JobApplicant("Miley", "123-127-4534",true,true,true,true);
// Four applicant objects
String qualifiedMsg="is qualified for an interview. Good luck!";
String notqualifiedMsg="is not qualified for an interview at this time. Better luck next time!";
if(isQualified(app1))
display(app1, qualifiedMsg);
else
display(app1, notqualifiedMsg);
if(isQualified(app2))
display(app2, qualifiedMsg);
else
display(app2, notqualifiedMsg);
if(isQualified(app3))
display(app3, qualifiedMsg);
else
display(app3, notqualifiedMsg);
if(isQualified(app4))
display(app4, qualifiedMsg);
else
display(app4, notqualifiedMsg);
}
public static boolean isQualified(JobApplicant app)
// Function to check whether the applicant is qualified or not
{
boolean isQual; // Variable to check whether the applicant is qualified or not.
int count=0;
if(app.getHasWordSkill())
count++;
if(app.getHasSpreadSheetSkill())
count++;
if(app.getHasDatabaseSkill())
count++;
if(app.getHasGraphicsSkill())
count++;
if(count>= 3)
isQual=true;
else
isQual=false;
return isQual;
}
public static void display(JobApplicant app, String msg)
//Function to display the status of applicants with their phone numbers
{
System.out.println(app.getName() + " " + msg + " Phone: " + app.getPhone());
}
} //End of class TestJobApplicant
Step3: Now run the java file named TestJobApplicant.java
Step4:Output is displayed as:
run:
Peter is not qualified for an interview at this time. Better luck next time! Phone: 123-124-4534
John is qualified for an interview. Good luck! Phone: 123-125-4534
Kate is not qualified for an interview at this time. Better luck next time! Phone: 123-126-4534
Miley is qualified for an interview. Good luck! Phone: 123-127-4534
BUILD SUCCESSFUL (total time: 0 seconds)
-----------------------------------------------------------------------------------
Hope this gives you a perfect solution. Please rate.ThankYou.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.