A person qualifies for CalFresh program (money for food) if he/she makes less th
ID: 3778351 • Letter: A
Question
A person qualifies for CalFresh program (money for food) if he/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.
Qualifiable.java
Student.java
/**
* 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());
}
}
}
Explanation / Answer
Qualifiable.java
______________________________________________________________
Student.java
______________________________________________________________
Person.java
______________________________________________________________
Runner.java
______________________________________________________________
Output
Fred
Amy
Thong
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.