//start of class
public class Calculator
{
//declaring integer vars a b and c
private int a, b, c;
//some mehods that sets vars a and b to 0?
public Calculator()
{
this(0, 0);
}
//sets A to a and B to b , this is because he made them private and not public ints
public Calculator(int a, int b)
{
this.a = a;
this.b = b;
}
//take ones fucking guess
public int geta()
{
return a;
}
public int getb()
{
return b;
}
//this is proberly not needed but yeah. it sets the number entered into a
public int seta(int a)
{
this.a = a;
return a;
}
//same as above but to b
public int setb(int b)
{
this.b = b;
return b;
}
public int total(int a, int b)
{
c = a + b;
return c;
}
//turns the numbers into strings to set result. Adds a and b.
public String toString()
{
String results = a + " + " + b + " = " + total(a,b);
return results;
}
//init's the whole thing, creates a new class of the "calcualtor class, sets a to 5 and b to 2 and writes the sum of them which is 7.
public static void main(String[] args)
{
Calculator calc = new Calculator(2,3);
calc.seta(5);
calc.setb(2);
System.out.println(calc.toString());
}
}