Hi all, I'll try to be as clear as I can...
I am creating a mini GUI project with a JFrame window that has two buttons added to it labelled 'Credit' and 'Deposit', my intention is to alsoadd two Textfields, one that allows the user to enter a nominal value of how much they wish to Credit or Deposit their balance by and another which shows the value of there resultant balance. Now, the steps are 1st the person enters a value into the textfield, 2nd presses either Credit or Deposit and 3rd the resulting balance shows the new value.
My issue is I am now in the process of defining how the 'credit' button works when pressed, which is to simply subtract the value of how much the user wishes to withdraw from account from balance value; However, I have been stopped in my tracks by the error message seen in the snippet of code below, why has this error arisen? and what is the solution?
------------------------------------------------------------------------------------------------------------------------
public class DefinitionAcc1{
public static DefinitionAcc1 creditAcc(DefinitionAcc1 ba, DefinitionAcc1 hm1){
DefinitionAcc1 result1 = new DefinitionAcc1();
result1 = ba - hm1; <----THIS LINE INVOKES THE ERROR MESSAGE: Bad operand for binary operator '-'
return result1;
}