/**
 * This represents ONE user's bank account.
 * It has their first name, last name, balances and loan they have to pay.
 * 
 * For each method, you should ensure it logically makes sense!
 *
 * @author (your name)
 * @version (a version number or a date)
 */
public class Account{
    private String firstName = null;
    private String lastName = null;
    private double balance = 0;
    private double loan = 0;
    /**
     * Constructor for objects of class account.
     * This is what you need to be able to define one account object.
     */
    public Account(String fname, String lname, double startBalance, double startLoan)
    {
        this.firstName = fname;
        this.lastName = lname;
        this.balance = startBalance;
        this.loan = startLoan;
    }

    /**
     * This is called if we want to deposit $$$ into the account
     */
    public void deposit(double amount){
        this.balance = this.balance + amount;
        System.out.println(this.balance);
    }
    
    /**
     * This is called if we want to withdraw $$$ from the account
     */
    public double withdraw(double amount){
        if(amount < 0){
            System.out.println("Error, amount must be positive");
            return (this.loan);
        }
        if(amount > balance){
            System.out.println("Error, amount must be less than balance");
            return (this.loan);
        }
        this.balance = this.balance - amount;
        return (this.balance);
    }
    
    /**
     * This is called if we want to make a payment to the loan
     */
    public double payLoan(double amount){
        if(amount < 0){
            System.out.println("Error, amount must be positive");
            return (this.loan);
        }
        if(amount > this.loan){
            System.out.println("Error, amount must be less than total owed sum");
            return (this.loan);
        }
        this.loan = this.loan - amount;
        return (this.loan);
    }
    
    /**
     * This is called if we want to see how much debt this account has
     */
    public double getDebt(){
        return (this.loan);
    }
    
    /**
     * This is called if we want to see the balance of this account
     */
    public double getBalance(){
        return (this.balance);
    }
    
}
