Question

In: Computer Science

Create a class that holds data about a job applicant. Include a name, a phone number,...

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!!!

Solutions

Expert Solution

/*
* ------------- 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 ----------------------------


Related Solutions

In java, create a class named Contacts that has fields for a person’s name, phone number...
In java, create a class named Contacts that has fields for a person’s name, phone number and email address. The class should have a no-arg constructor and a constructor that takes in all fields, appropriate setter and getter methods. Then write a program that creates at least five Contact objects and stores them in an ArrayList. In the program create a method, that will display each object in the ArrayList. Call the method to demonstrate that it works. Include javadoc...
Create a class called Student. Include the following instance variables: name, address, phone, gpa Create all...
Create a class called Student. Include the following instance variables: name, address, phone, gpa Create all of the methods required for a standard user defined class: constructors, accessors, mutators, toString, equals Create the client for testing the Student class Create another class called CourseSection Include instance variables for: course name, days and times course meets (String), description of course, student a, student b, student c (all of type Student) Create all of the methods required for a standard user defined...
Create a class Team to hold data about a college sports team. The Team class holds...
Create a class Team to hold data about a college sports team. The Team class holds data fields for college name (such as Hampton College), sport (such as Soccer), and team name (such as Tigers). Include a constructor that takes parameters for each field, and get methods that return the values of the fields. Also include a public final static String named MOTTO and initialize it to Sportsmanship! Save the class in Team.java. Create a UML class diagram as well....
Create a class Team to hold data about a college sports team. The Team class holds...
Create a class Team to hold data about a college sports team. The Team class holds data fields for college name (such as Hampton College), sport (such as Soccer), and team name (such as Tigers). Include a constructor that takes parameters for each field, and get methods that return the values of the fields. Also include a public final static String named MOTTO and initialize it to Sportsmanship! Save the class in Team.java. Write an application named TestTeam with the...
Create a class named Salesperson. Data fields for Salesperson include an integer ID number and a...
Create a class named Salesperson. Data fields for Salesperson include an integer ID number and a doubleannual sales amount. Methods include a constructor that requires values for both data fields, as well as get and set methods for each of the data fields. Write an application named DemoSalesperson that declares an array of 10 Salesperson objects. Set each ID number to 9999 and each sales value to zero. Display the 10 Salesperson objects. public class DemoSalesperson { public static void...
Write a class named ContactEntry that has fields for a person’s name, phone number and email...
Write a class named ContactEntry that has fields for a person’s name, phone number and email address. The class should have a no-arg constructor and a constructor that takes in all fields, appropriate setter and getter methods. Then write a program that creates at least five ContactEntry objects and stores them in an ArrayList. In the program create a method, that will display each object in the ArrayList. Call the method to demonstrate that it works. I repeat, NO-ARG constructors....
Create a class named CollegeCourse that includes the following data fields: dept (String) - holds the...
Create a class named CollegeCourse that includes the following data fields: dept (String) - holds the department (for example, ENG) id (int) - the course number (for example, 101) credits (double) - the credits (for example, 3) price (double) - the fee for the course (for example, $360). All of the fields are required as arguments to the constructor, except for the fee, which is calculated at $120 per credit hour. Include a display() method that displays the course data....
Overriding the equals Method File Player.java contains a class that holds information about an athlete: name,...
Overriding the equals Method File Player.java contains a class that holds information about an athlete: name, team, and uniform number. File ComparePlayers.java contains a skeletal program that uses the Player class to read in information about two baseball players and determine whether or not they are the same player. Fill in the missing code in ComparePlayers so that it reads in two players and prints “Same player” if they are the same, “Different players” if they are different. Use the...
Write a class named RetailItem that holds data about an item in retail store.
Python 3Your program will have 2 classes:A) RetailItem ClassWrite a class named RetailItem that holds data about an item in retail store.Attributes: The class should store following data in attributes:>item_Name> PriceMethods:> RetailItem class’s __init__ method should accept an argument for each attribute.> RetailItem class should also have accessor and mutator methods for each attributeB) MainMenu ClassAttributes: The class should store following data in attributes:> List of RetailItem Objects: InventoryMethods:> createInventory(): method to create three RetailItem Objects store in list Inventory...
Design a class that holds the following data regarding a music album: artist, title, number of...
Design a class that holds the following data regarding a music album: artist, title, number of tracks, and year released. Write appropriate accessor and mutator methods. Also, write a program that creates three instances of the class. Each instance will hold information about a different music album. Make sure to display all of the information for all three albums to the screen in an organized manner. **Using python**
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT