# Calculator project

Hey i’m doing this project in java
and step 18 asks you to improve it.
I managed to improve it and it works but I feel like I am not doing it like I’m suppose to… with too much code, or like I’m missing features or something. Is there a better or cleaner way to do what I did? Here is my code after I improved it from the lesson.

``````public class Calculator{

public Calculator(){

}

public double add(double a, double b){
return a + b;
}
public double subtract(double a, double b){
return a - b;
}
public double multiply(double a, double b){
return a * b;
}
public double divide(double a, double b){
return a / b;
}
public int modulo(int a, int b){
return a % b;
}

public static void main(String [] args){
// SUBTRACT NUMBERS HERE
double aSub = 5;
double bSub = 2;
// MULTIPLY NUMBERS HERE
double aMult = 5;
double bMult = 7;
// DIVIDE NUMBERS HERE
double bDiv = 7;
// MODULO NUMBERS HERE
int aMOD = 10;
int bMOD = 3;

Calculator myCalculator = new Calculator();

System.out.println("Subtraction: \n" + aSub + " - " + bSub + " = " + myCalculator.subtract(aSub, bSub));

System.out.println("Multiplication: \n" + aMult + " X " + bMult + " = " + myCalculator.multiply(aMult, bMult));

System.out.println("Division: \n" + aDiv + " / " + bDiv + " = " + myCalculator.divide(aDiv, bDiv));

System.out.println("Modulo: \n" + "The remainder of " + aMOD + " divided by " + bMOD + " is " + myCalculator.modulo(aMOD, bMOD));

}

}
``````