# 12 errors Calculator project Modulo and main method

#1

Calculator.java:25: error: illegal start of expression
public int modulo(int a, int b){
^
Calculator.java:25: error: ';' expected
public int modulo(int a, int b){
^
Calculator.java:25: error: expected
public int modulo(int a, int b){
^
Calculator.java:25: error: not a statement
public int modulo(int a, int b){
^
Calculator.java:25: error: ';' expected
public int modulo(int a, int b){
^
Calculator.java:32: error: illegal start of expression
public static void main(String [] args){
^
Calculator.java:32: error: illegal start of expression
public static void main(String [] args){
^
Calculator.java:32: error: ';' expected
public static void main(String [] args){
^
Calculator.java:32: error: '.class' expected
public static void main(String [] args){
^
Calculator.java:32: error: ';' expected
public static void main(String [] args){
^
Calculator.java:33: error: '(' or '[' expected
Calulator myCalculator = new myCalculator;
^
Calculator.java:38: error: reached end of file while parsing
}
^
12 errors

``````public class Calculator{
public Calculator(){

}
public int add(int a, int b){
return a + b;
}

public int substract(int a, int b){
return a - b;
}

public int multiply(int a, int b){
return a * b;
}

public int divide(int a, int b){
if(b == 0){
System.out.println("Error! Dividing by zero is not allowed.");
return 0;
} else {
return a / b;
}

public int modulo(int a, int b){
if(b == 0){
System.out.println("Error! Dividing by zero is not allowed.");
return 0;
} else {
return a % b;
}
public static void main(String [] args){
Calulator myCalculator = new myCalculator;
System.out.println(myCalulator.substract(45,11));
}
}
}``````

#2

public class Calculator{
public Calculator(){

}
public int add(int a, int b){
return a + b;
}

public int substract(int a, int b){
return a - b;
}

public int multiply(int a, int b){
return a * b;
}

public int divide(int a, int b){
if(b == 0){
System.out.println("Error! Dividing by zero is not allowed.");
return 0;
} else {
return a / b;
}
}

``````public int modulo(int a, int b){
if(b == 0){
System.out.println("Error! Dividing by zero is not allowed.");
return 0;
} else {
return a % b;
}
}``````

public static void main(String[] args) {
Calculator myCalculator = new Calculator();