Question: JAVA!! Please help me fix the code. public class PersonApp { private String name; private int age; private double income; public PersonApp() { name =

JAVA!! Please help me fix the code.

public class PersonApp { private String name; private int age; private double income;

public PersonApp() { name = " "; age = 0; income = 0.0; } public PersonApp(String n, int a, double i) { name = n; age = a; income = i; } public String getName() { return name; } public int getAge() { return age; } public double getIncome() { return income; } public void setName(String n) { name = n; } public void setAge(int a) { age = a; } public void setIncome(double i) { income = i; } public boolean equals(Object anotherPerson) { return(name.equalsIgnoreCase((PersonApp)anotherPerson.name()) && age == ((PersonApp)anotherPerson.age() && Math.abs(income - ((PersonApp)anotherPerson.income()) < 0.01); } }

public class TestPersonApp { public static void main(String[] args) { PersonApp person = new PersonApp("m",23,0); System.out.println("Name: " + person.getName()); System.out.println("Age: " + person.getAge()); System.out.println("Income: " + person.getIncome()); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!