60.2k views
5 votes
Create a class 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. Create an application that instantiates several job applicant objects and pass each in turn to a Boolean method 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. Save the files as JobApplicant.java and TestJobApplicants.java.

User Biqarboy
by
5.4k points

2 Answers

6 votes

Answer:

Step-by-step explanation:

I don't know about the answer in java.

This is what I did in C#. Find attached the answer

public class JobApplication

{

private string name;

public string Name

{

get { return name; }

set { name = value; }

}

private string phoneNumber;

public string PhoneNumber

{

get { return phoneNumber; }

set { phoneNumber = value; }

}

private bool isSKilledInWordProcessing;

public bool IsSkilledInWordProcessing

{

get { return isSKilledInWordProcessing; }

set { isSKilledInWordProcessing = value; }

}

private bool isSkilledInSpreadsheets;

public bool IsSkilledInSpreadsheets

{

get { return isSkilledInSpreadsheets; }

set { isSkilledInSpreadsheets = value; }

}

private bool isSkilledInDatabases;

public bool IsSkilledInDatabases

{

get { return isSkilledInDatabases; }

set { isSkilledInDatabases = value; }

}

private bool isSkilledInGraphics;

public bool IsSkilledInGraphics

{

get { return isSkilledInGraphics; }

set { isSkilledInGraphics = value; }

}

public JobApplication(string name, string phoneNumber, bool isSKilledInWordProcessing,

bool isSkilledInSpreadsheets, bool isSkilledInDatabases, bool IsSkilledInGraphics)

{

Name = name;

PhoneNumber = phoneNumber;

IsSkilledInDatabases = isSkilledInDatabases;

IsSkilledInGraphics = isSkilledInGraphics;

IsSkilledInWordProcessing = IsSkilledInWordProcessing;

IsSkilledInSpreadsheets = isSkilledInSpreadsheets;

}

}

class Program

{

static void Main(string[] args)

{

JobApplication jobApplication1 = new JobApplication("Emmanuel Man", "+39399399", false, true, true, true);

CheckIfQualified(jobApplication1);

}

static void CheckIfQualified(JobApplication jobApplication)

{

if(jobApplication.IsSkilledInSpreadsheets && jobApplication.IsSkilledInGraphics

&& jobApplication.IsSkilledInWordProcessing && jobApplication.IsSkilledInDatabases)

{

Console.WriteLine("The applicant, " + jobApplication.Name + " is qualified for the job");

} else if (jobApplication.IsSkilledInSpreadsheets && jobApplication.IsSkilledInGraphics

&& jobApplication.IsSkilledInWordProcessing)

{

Console.WriteLine("The applicant, " + jobApplication.Name + " is qualified for the job");

}

else if (jobApplication.IsSkilledInSpreadsheets && jobApplication.IsSkilledInGraphics

&& jobApplication.IsSkilledInDatabases)

{

Console.WriteLine("The applicant, " + jobApplication.Name + " is qualified for the job");

} else if (jobApplication.IsSkilledInWordProcessing && jobApplication.IsSkilledInGraphics

&& jobApplication.IsSkilledInDatabases)

{

Console.WriteLine("The applicant, " + jobApplication.Name + " is qualified for the job");

}else if (jobApplication.IsSkilledInWordProcessing && jobApplication.IsSkilledInSpreadsheets

&& jobApplication.IsSkilledInDatabases)

{

Console.WriteLine("The applicant, " + jobApplication.Name + " is qualified for the job");

}

else

{

Console.WriteLine("The applicant, " + jobApplication.Name + " is not qualified for the job");

}

}

}

User Httqm
by
4.7k points
4 votes

Answer:

import java.util.Scanner;

public class TestJobApplicant{

public static void main(String[] args)

{

JobApplicant applicant1 = new JobApplicant("Ted","555-1234", true, false, false, false);

JobApplicant applicant2 = new JobApplicant("Lily", "655-1235", true, false, true, false);

JobApplicant applicant3 = new JobApplicant("Marshall", "755-1236", false, false, false, false);

JobApplicant applicant4 = new JobApplicant("Barney", "855-1237", true, true, true, false);

JobApplicant applicant5 = new JobApplicant("Robin", "955-1238", true, true, true, true);

String qualifiedMessage = "is qualified for an interview. ";

String notQualifiedMessage = "is not qualified for an interview at this time. ";

if (isQualified(applicant5))

display(applicant5, qualifiedMessage);

else

display(applicant5, notQualifiedMessage);

}

public static boolean isQualified(JobApplicant applicant) {

int count = 0;

boolean isQualified;

final int MIN_SKILLS = 3;

if(applicant.getWord())

count += 1;

if(applicant.getSpreadsheet())

count += 1;

if(applicant.getDatabase())

count += 1;

if(applicant.getGraphics())

count += 1;

if(count >= MIN_SKILLS)

isQualified = true;

else

isQualified = false;

return isQualified;

}

public static void display(JobApplicant applicant, String message) {

System.out.println(applicant.getName() + " " + message +" Phone: " + applicant.getPhone());

}

}

class JobApplicant {

private String name, phone;

private boolean word, spreadsheet, database, graphics;

public JobApplicant(String name, String phone, boolean word, boolean spreadsheet, boolean database, boolean graphics){

this.name = name;

this.phone = phone;

this.word = word;

this.spreadsheet = spreadsheet;

this.database = database;

this.graphics = graphics;

}

public String getName() {return name;}

public String getPhone() {return phone;}

public boolean getWord() {return word;}

public boolean getSpreadsheet() {return spreadsheet;}

public boolean getDatabase() {return database;}

public boolean getGraphics() {return graphics;}

}

Step-by-step explanation:

Inside the JobApplicant class:

- Declare the variables

- Initialize the constructor

- Create the get methods for each variable

Inside the TestJobApplicant class:

- Create an isQualified method that checks if given applicant is qualified for the job.

- Create a display method that prints the name, message and phone number for the applicant

Inside the main:

- Initialize the applicant objects and messages

- Call the isQualified method with an applicant to see the result

User Cavpollo
by
4.4k points