Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Use the following files: Qualifiable.java Student.java Code the following files:

ID: 3774139 • Letter: U

Question

Use the following files:

Qualifiable.java

Student.java

Code the following files:

/**
* models a person with a name and an annualIncome
*/
public class Person
{
private String name;
private double monthlyIncome;
  
public Person(String theName, double income)
{
name = theName;
monthlyIncome = income;
}
  
public String getName()
{
return name;
}
  
public double getMonthlyIncome()
{
return monthlyIncome;
}
}

public class Runner
{
public static void main(String[] args)
{
Qualifiable[] candidates = new Qualifiable[5];

candidates[0] = new Person("Susan", 2000.0);
candidates[1] = new Person("Fred", 1961.99 );
candidates[2] = new Person("Jack", 1962.00);
candidates[3] = new Person("Amy", 1200.00 );
candidates[4] = new Student("Thong", 3.6 );
  
for (Qualifiable c : candidates)
{
System.out.println(c.qualifies());
}
}
}

A person qualifies for CalFresh program money for food if She makes less than $1962 a month. You are given a Person class. A Person has a name and a monthly income. Modify the Person class to implement the Qualifiable interface and determine if a person is eligible for CalFresh. For the final, modify Runner. Remove the code to print true or false and print the name of each Person in the array that qualifies for CalFresh. This is the first time you have submitted a tester. If you have trouble understanding what to do, ask in Piazza. Note: You will also need to put the Student class into the project.

Explanation / Answer

***************************************Runner.java**********************************************************


package runner;

public class Runner {

public static void main(String[] args) {
Qualifiable[] candidates = new Qualifiable[5];
candidates[0] = new Person("Susan", 2000.0);
candidates[1] = new Person("Fred", 1961.99 );
candidates[2] = new Person("Jack", 1962.00);
candidates[3] = new Person("Amy", 1200.00 );
candidates[4] = new Student("Thong", 3.6 );
  
//the following loop outputs the names for calFresh Program
System.out.println("The names eligible for CalFresh program are as follow: ");
for(int i=0;i<5;i++){
candidates[i].qualifies();
}
  
}
  
}
  

**********************************************Student.java****************************************************

package runner;
/**
* Describes a Student with a name and grade point.
*
*/
public class Student implements Qualifiable
{
private String name;
private double gpa;
private double QUALIFYING_GPA = 3.54;
  
/**
* Creates a student
* @param theName the name of this student
* @param theGpa the gpa of this student
*/
public Student(String theName, double theGpa)
{
name = theName;
gpa = theGpa;
}
  
/**
* Gets the name of this student
* @return the name of this student
*/
public String getName()
{
return name;
}
  
/**
* Gets the GPA of this student
* @return the GPA of this student
*/
public double getGPA()
{
return gpa;
}

public boolean qualifies()
{
return gpa >= QUALIFYING_GPA;
}
}

********************************************Person.java*****************************************

package runner;
public class Person implements Qualifiable
{
private String name;
private double monthlyIncome;
  
public Person(String theName, double income)
{
name = theName;
monthlyIncome = income;
}
  
public String getName()
{
return name;
}
  
public double getMonthlyIncome()
{
return monthlyIncome;
}

//defining the qualifies method of Qualifiable Interface
@Override
public boolean qualifies() {
//checking condition for CalFresh Program
if(monthlyIncome<1962){
System.out.println("Name:"+name); //Printing name eligible for calFresh program
return true;
}
else
return false;
}
}

******************************************************Qualifiable.java******************************************************


package runner;

public interface Qualifiable
{

boolean qualifies();
}

******************************************************Program output****************************************

run:
The names eligible for CalFresh program are as follow:

Name:Fred
Name:Amy


BUILD SUCCESSFUL (total time: 0 seconds)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote