Firstly, buyFunction(int balance, double amountSpent)
is a method, not a class. Secondly:
boolean buyFunction buy = buyFunction();
Looks like it has two names, which a variable can't have. Also, when you called the method, you did not pass in an int, and a double. Also, to call the method without an instance of a class, you'd have to instantiate the object.
Here is something that could work:
YourClassName y = new YourClassName();
boolean buy = y.buyFunction(500, 45.50);
Now if you don't want to make an object, and just call the function, you could make use the static
keyword:
public static boolean buyFunction(int balance, double amountSpent)
Now you can call it like this:
boolean buy = buyFunction(500, 45.50);
This would pass 500 to the balance parameter, and 45.50 to the amountSpent parameter.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…