Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Question about forming a method that re-display information

$
0
0
I'm trying to create a method that will display data from another method .Below is the code I need to link too

class TestBank
{
   public static void main(String[] arg)
   {
   Bank b = new Bank(100, "098-055-9325");
   System.out.println("Account: " +[b] b.getAccountNumber()[/b] + "\tOpening balance $" + b.getBalance());
   b.deposit(50);
   System.out.println("Deposit $" +[b] b.getTransaction()[/b] + "\t\tNew balance $" + b.getBalance());
   b.withdraw(25);
   System.out.println("Withdraw $" + [b]b.getTransaction()[/b] + "\t\tNew balance $" + b.getBalance());
   b.deposit(150);
   System.out.println("Deposit $" + [b]b.getTransaction()[/b] + "\t\tNew balance $" + b.getBalance());
   }

}



I'm not allowed to touch the above code so I need to fill the blanks. That said , I completed most of it I'm just stuck in the part I want to use " getTransaction" to display the deposit amount . Below is my fill in blanks code .


public class Bank
{
    private String account;
    private double balance; 
    
    
    public Bank ( double currentAmount , String accountNumber)
    {
        account = accountNumber;
        balance = currentAmount;
    }
    
        public String getAccountNumber()
        {
            return account; 
        }
        public double getBalance ()
        {
            return balance; 
        }
        public double deposit (double added )
        {
            getTransaction(added);
            balance = balance + added;
            return balance;
        }
        
        public double withdraw (double subtracted)
        {
           getTransaction(subtracted);
           balance = balance - subtracted;
           return balance;
        }
        public void getTransaction ()
        {
            
        }
        
}




Any leads would be big help to get "getTransaction " to work

Viewing all articles
Browse latest Browse all 51036

Trending Articles