In: Computer Science
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. Make sure your JobApplicant.java file runs with this file TestJobApplicants: I can not get the JobApplicant to work. Here is the program:
import java.util.Scanner;
class JobApplicant
{
private String name;
private String phone;
// boolean variables for word,spreadsheet,database and graphics
skills
private boolean w;
private boolean s;
private boolean d;
private boolean g;
  
//The constructor. This needs to set all the properties of this
class
public JobApplicant(String name, String phone, boolean w, boolean
s, boolean d, boolean g)
{
this.name = name;
this.phone = phone;
this.w = w;
this.s = s;
this.d = d;
this.g = g;
}
public String getName()
{
return name;
}
public boolean getHasWordSkill()
{
return w;
}
//get methods
public boolean getHasSpreadsheetSkill()
{
return s;
}
public boolean getHasDatabaseSkill()
{
return d;
}
public boolean getHasGraphicsSkill()
{
return g;
}
public String getPhone()
{
return phone;
}
}
It is telling me no main methods, JavaFX Applications, applets or MIDlets found in file..HELP!!!
/*
* ------------- JobApplicant.java ----------------
* The code you have written is right but your class has no main
method that's why
* you are getting that message on runtime.
* well you shouldn't write main method in the class JobApplicant
because,
* in the question there is a mentioning about
* " 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."
* and it will be tested by TestJobApplicants.java
* so i have created another java class called
TestQualified.java
* where you will find a method that takes a JobApplicant object and
returns
* a boolean value whether the applicant has atleast 3 skills or
not.
* in TestJobApplicants.java objects for JobApplicant are created
and
* also TestQualified object is also created.
* using that TestQualified object testing of each JobApplicant is
done.
* you may ask that in question they said create an application that
instantiates several job applicant
* but you have created them in TestJobApplicants.java, i have
created them in TestJobApplicants.java
* because the code of the TestJobApplicants is not given and there
is a confusing.
*
* so you save three files JobApplicant.java and TestQualified.java
and TestJobApplicants.java
* if you want any modifiications please comment and if the code is
reached your expectation
* please like the answer.
*/
import java.util.Scanner;
class JobApplicant {
   private String name;
   private String phone;
// boolean variables for word,spreadsheet,database and graphics
skills
   private boolean w;
   private boolean s;
   private boolean d;
   private boolean g;
//The constructor. This needs to set all the properties of this
class
   public JobApplicant(String name, String phone, boolean
w, boolean s, boolean d, boolean g) {
       this.name = name;
       this.phone = phone;
       this.w = w;
       this.s = s;
       this.d = d;
       this.g = g;
}
   public String getName() {
       return name;
   }
   public boolean getHasWordSkill() {
       return w;
   }
//get methods
   public boolean getHasSpreadsheetSkill() {
       return s;
   }
   public boolean getHasDatabaseSkill() {
       return d;
   }
   public boolean getHasGraphicsSkill() {
       return g;
   }
   public String getPhone() {
       return phone;
   }
}
//------------- TestQualified.java ----------
/*
* Application TestQualified.java that contains method which takes a
JobApplicant object
* and returns a boolean variable whether the person is qualified
for interview or not.
*/
public class TestQualified
{
   //method isQualified that takes a JobApplicant object
and returns
   //whether he qualified or not (a boolean value)
.
   public boolean isQualified(JobApplicant person)
   {
       //count variable to store the
number of skills JobApplicant object has.
       int count = 0;
       //for each of the skills if person
has skill increment the count
      
if(person.getHasDatabaseSkill())
       {
           count++;
       }
      
if(person.getHasGraphicsSkill())
       {
           count++;
       }
      
if(person.getHasSpreadsheetSkill())
       {
           count++;
       }
       if(person.getHasWordSkill())
       {
           count++;
       }
      
       //check if the count is
>=3(atleast three skills)
       if(count >=3)
       {
           //if has more
than 3 skills return true(qualified)
           return
true;
       }
       else
       {
           //if dont have
more than 3 skills return true(not qualified)
           return
false;
       }
   }
     
}
//------------- TestJobApplicants.java ----------
/*
* TestJobApplicants.java is the tester file that tests the
jobapplicant class objects
* by passing them to isQualified(JobApplicant person) in
TestQualified.java
*
*/
public class TestJobApplicants
{
   //method that takes JobApplicant and status of the
qualified or not
   //and prints the result according to it.
   public static void printStatus(JobApplicant
person,boolean stat)
   {
       if(stat)
       {
          
System.out.println(person.getName()+" is Qualified for
interview");
       }
       else
       {
          
System.out.println(person.getName()+" is Not Qualified for
interview");
       }
   }
   public static void main(String[] args)
   {
       JobApplicant person1 = new
JobApplicant("John Wick","9087612345",true,true,false,false);
       JobApplicant person2 = new
JobApplicant("Tony Stark","9087654321",true,true,true,true);
       JobApplicant person3 = new
JobApplicant("Charles
Xavier","9087123456",false,false,false,false);
       JobApplicant person4 = new
JobApplicant("Logan","9087654321",true,true,false,true);
      
      
       TestQualified tester = new
TestQualified();
      
       printStatus(person1,
tester.isQualified(person1));
       printStatus(person2,
tester.isQualified(person2));
       printStatus(person3,
tester.isQualified(person3));
       printStatus(person4,
tester.isQualified(person4));
   }
}
//------------------- OUTPUT
----------------------------
