Need in Java programming
8. Google Inc. is looking to recruit three of the Boston runners. The criteria for selection are as follows:
I. Average final marks in bachelor’s degree (store up to 2 decimal places). The fifteen candidates have the following grades: 82.30%, 85.10%, 77.77%, 69.93%, 93.03%, 88.61%, 55.99%, 87.49%, 88.00%, 91.20%, 66.79%, 76.65%, 55.89%, 90.01%, and 87.9%.
II. Ability to communicate as one of the three values – “excellent”, “average”, and “poor”. The fifteen candidates have the following ability to communicate, respectively: poor, poor, average, average, average, poor, excellent, excellent, excellent, average, excellent, average, excellent, excellent, poor.
III. Innovation as one of the two values – “brilliant” and “average” (store as a Boolean; brilliant = true and average = false). The fifteen candidates have the following innovative abilities: brilliant, average, average, average, brilliant, brilliant, average, brilliant, average, brilliant, average, brilliant, brilliant, average, average.
IV. Ability to regulate one’s own skill as a probability value between 0 and 1.0 – 1.0 implies excellent regulatory capabilities and 0.0 implies no skills to regulate (store as a double). The fifteen candidates have the following regulatory abilities: 0.5, 1.0, 0.8, 0.0, 1.0, 0.7, 0.8, 0,9, 0.5, 0.6, 0.3, 0.2, 0.5, 0.3, 0.8.
Store these values for the fifteen candidates in an extended
AddressBook class. In general, Google will not consider a candidate
with average marks of less than 85%. Google will consider a
candidate with average marks of less than 85% only if the candidate
at least has 0.5 regulatory abilities and at least ‘average’
ability to communicate. Google will only consider a candidate with
poor communication ability if the candidate has a ‘brilliant’
innovation capability. Write a program that will help Google to
programmatically determine eligibility of the fifteen candidates
for these positions, and print the output on the console.
Computer Science 268: Introduction to Programming (Java) Page 8 of
11
Created three classes as
-> Candidate Class to store data of single candidate
-> Address Book Class to store all candidates
-> Recruit Class is Main Class
Code: (Text Code Also included in End)
Candidate.java


AddressBook.java

Recruit.java


Output:

Code:
Candidate.java
// Candidate Class for store data of One Candidate
public class Candidate {
// Initlizing Variables
private double average, regulation;
private String communication;
private Boolean innovation;
// Constructor
public Candidate(double average, double
regulation, String communication, Boolean innovation) {
this.average =
average;
this.regulation =
regulation;
this.communication =
communication;
this.innovation =
innovation;
}
/*
All Getter Setter for
all Variables
*/
public double getAverage() {
return average;
}
public void setAverage(double average)
{
this.average =
average;
}
public double getRegulation() {
return regulation;
}
public void setRegulation(double regulation)
{
this.regulation =
regulation;
}
public String getCommunication() {
return
communication;
}
public void setCommunication(String
communication) {
this.communication =
communication;
}
public Boolean getInnovation() {
return innovation;
}
public void setInnovation(Boolean innovation)
{
this.innovation =
innovation;
}
}
AddressBook.java
import java.util.ArrayList;
// Address Book class for store candidates data
public class AddressBook {
// Declaring candidates array
private ArrayList<Candidate>
candidates;
// Address Book Constructor
public AddressBook() {
candidates = new
ArrayList<>();
}
// Adding Candidate
public void addCandidate(Candidate
candidate){
candidates.add(candidate);
}
// Getting Candidates List
public ArrayList<Candidate>
getCandidates() {
return candidates;
}
}
Recruit.java
import java.util.ArrayList;
// Main Class
public class Recruit {
// Declaring addressBook Variable
private static AddressBook addressBook;
public static void main(String[] args)
{
addressBook = new
AddressBook(); // Initlizing address book object
fillAddressBook(); // Filling address book object with data
checkEligiblity(); //
Checking eligiblity of all candidates
}
// Method for fill data in address boook
object
private static void fillAddressBook() {
// Original data
Storing
double[] averages =
{82.30, 85.10, 77.77, 69.93, 93.03, 88.61, 55.99, 87.49, 88.00,
91.20, 66.79, 76.65, 55.89, 90.01, 87.9};
String[] communication =
{"poor", "poor", "average", "average", "average", "poor",
"excellent",
"excellent", "excellent", "average", "excellent", "average",
"excellent", "excellent", "poor"};
boolean[] innovation =
{true, false, false, false, true, true, false, true, false, true,
false, true, false, true, true, false, false};
double[] regulation =
{0.5, 1.0, 0.8, 0.0, 1.0, 0.7, 0.8, 0.9, 0.5, 0.6, 0.3, 0.2, 0.5,
0.3, 0.8};
// Looping through
data and adding in address boook
for (int i = 0; i <
15; i++) {
Candidate c = new Candidate(averages[i], regulation[i],
communication[i], innovation[i]);
addressBook.addCandidate(c);
}
}
// Method for check and print
eligiblity
private static void checkEligiblity() {
ArrayList<Candidate> candidates = addressBook.getCandidates(); // Getting all candidates list
int i = 0;
// Looping through
candidates
for (Candidate candidate
: candidates) {
i++;
boolean eligible = false;
if (candidate.getAverage() >= 85.0) { // if % is more than 85 =
eligible
eligible = true;
} else {
if (candidate.getRegulation() >= 0.5 &&
!candidate.getCommunication().equals("poor")) {
eligible = true; // else if communication is not poor and
regulation more tgab 0.5
} else if (candidate.getCommunication().equals("poor") &&
candidate.getInnovation()) {
eligible = true; // else if communication is ppor but brilliant
innovation
}
}
// Printing Eligiblity
if (eligible) {
System.out.println("Candiadte " + i + " Eligible");
} else {
System.out.println("Candiadte " + i + " Not Eligible");
}
}
}
}
Need in Java programming 8. Google Inc. is looking to recruit three of the Boston runners....