I have an assignment that I have no idea how to complete. Tried google and everything, still no idea.
Assignment is:
create a class Calculator witch contains following:
- constant pi (done)
- constructor that accepts two following integers: operand1 and operand2 (done)
- method to print out values of operand1 and operand2 (done)
- instance methods for adding, subtracting, multiplying and division of operand1 and operand2 (done)
- static methods for these same operations that accepts operand1 and operand2 as parameters (not done)
- instance method for calculating area of circle with pi and operand1 (done)
In main method create object of class Calculator and call all methods and write result of all methods in console.
I don't want anyone writing a code for me, I just need guidelines on how to get operand1 and operand2 as parameters inside static method, because I have no idea how to start.
I attempted the following code:
public static int add(operand1, operand2)
{
return operand1 + operand2;
}
and got the following error:
Identifier expected, an object reference is required for non-static field, method or property.