Im trying to call the method "public void insertCard(int p)" within the same class into the method " public void deposit (double amount) "

My code for both methods is displayed below. the objective would be to have the deposit method return the last print statement if the card is not inserted/pin is not true.

**Insert Card : **

public void insertCard(int p) 
    {
        if (p == pinNumber) 
        {
            card = true;
            System.out.println ("Hello " + firstName + " Welcome to LLS Bank!");
        }
        else 
        {
            card = false; 
            System.out.println ("Incorrect Pin Number, Please Try again.");
        }
    }

**Deposit Method: ****

  public void deposit(double amount) 
    {
        int p;
        p = pinNumber;



        if (p != pinNumber) 
        {
            card = false;
            System.out.println ("Incorrect PIN");

        }
        else if (p==pinNumber && amount < 0) 
        {

            card = true; 
            System.out.println ("Transaction cannot be completed. Cannot deposit amounts less than zero.");

        }
        else 
        {
            card = true;
            accountBalance = accountBalance + amount;
            transactions ++;
            System.out.println("Transaction Completed. Thank you.");

        }

    }
if (p == pinNumber) {
    deposit();
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.