So in my homework for a Java course we had to modify a class and then write a tester class in Jgrasp, my tester class looks like this
public class BankAccountTester {
public static void main(String[]args){
BankAccount account = new BankAccount(1000);
account.setFreeTrans(5);
account.setTransFee(2);
account.deposit(1000);
account.withdraw(500);
account.withdraw(400);
account.deposit(200);
System.out.println(account.getBalance());
System.out.println("expected: 1300");
account.monthlyCharge();
System.out.println(account.getBalance());
System.out.println("expected: 1300");
account.deposit(1000);
account.withdraw(500);
account.withdraw(400);
account.deposit(500);
System.out.println(account.getBalance());
System.out.println("expected: 1900");
account.monthlyCharge();
System.out.println(account.getBalance());
System.out.println("expected: 1900");
account.deposit(1000);
account.withdraw(500);
account.withdraw(400);
account.deposit(200);
account.deposit(500);
account.withdraw(1000);
System.out.println(account.getBalance());
System.out.println("expected 1700");
account.monthlyCharge();
System.out.println(account.getBalance());
System.out.println("expected 1698");
account.deposit(1000);
account.withdraw(500);
account.withdraw(400);
account.deposit(200);
account.deposit(500);
account.withdraw(1000);
account.deposit(100);
System.out.println(account.getBalance());
System.out.println("expected 1598");
account.monthlyCharge();
System.out.println(account.getBalance());
System.out.println("expected 1594");
}
}
So The Issues I having is that it is not printing out all the values I programed it to print out, it should print out somthing that looks like this:
1300
expected: 1300
1300
expected 1300
1900
expected 1900
1900
expected 1900
1700
expected 1700
1698
expected 1698
1598
expected 1598
1594
expected 1594
but instead all I am getting is this:
1300.0
expected: 1300
1300.0
expected: 1300
1900.0
expected: 1900
1900.0
expected: 1900
does anybody know what this is as I cannot figure out a reason it would do this. note this testing is done the the workbench for JGrasp. Thanks