1
votes

I am not sure Why but when I run my program with eclipse and I am trying to verify my methods and variables all work my program misses all tasks please can someone explain or point me in the direction for my solution

package java.Shmoney.Model;

/**
 * Able to calcualte someones Budget
 * @author dujuanny
 *
 */
 public class Budget extends Person{
    
    private double totalIncome;

    private double expense;
    private Map<String, List<Double>> totalBudget;
    
    public Budget() {
        
    }
    
    public double getTotalIncome() {
        return totalIncome;
    }

    public void addTotalIncome(double totalIncome) {
        this.totalIncome += totalIncome;
    }
    
    public void setTotalIncome(double totalIncome) {
        this.totalIncome = totalIncome;

    }

    public double getCost() {
        return expense;
    }
    public void addToBudget(String description, List<Double> expense) {
        totalBudget.put(description, expense);
    }
    public Map<String, List<Double>> getTotalBudget() {
        return totalBudget;
    }
    public void setTotalBudget(Map<String, List<Double>> totalBudget) {
        this.totalBudget = totalBudget;
    }
    

    @Override
    public String toString() {
        return super.toString() + "Budget [totalIncome=" + totalIncome + ", expense=" + expense + ", totalBudget=" + totalBudget + "]";
    }

    public static void main(String[] args) {
        Budget jay = new Budget();
        jay.setTotalIncome(10000);
        System.out.println(jay.toString());
    }

}

Second Class

public abstract class Person {
    
    private String firstName;
    private String lastName;
    private String email;
    
    public String getFirstName() {
        return firstName;
    }
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }
    public String getLastName() {
        return lastName;
    }
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    @Override
    public String toString() {
        return " Person [ FirstName = " + firstName + ", LastName = " + lastName + ", Email =" + email + " ]";
    }

}
Does it even compile? You appear to be missing some key import statements including imports for java.util.List and java.util.Map - Hovercraft Full Of Eels
Solved had Java in my package keyword - JuJu
Sorry very New with stack overflow but I can program with Java and connect to a db I am very new - JuJu
You should be posting the compilation error in your question as it is quite important - Hovercraft Full Of Eels
probably should have again I dont use Stack overflow I am not user friendly with how do I show my questions as answered greatly appreciated or not - JuJu