Getting error for the % operator.
What does returning b as b percent of a mean exactly? Is it remainder or actual percent, and percent of what?
package com.codegym.task.task06.task0612;
/*
Calculator
Make a Calculator class, which will have 5 static methods:
int plus(int a, int b) - returns the sum of a and b
int minus(int a, int b) - returns the difference between a and b
int multiply(int a, int b) - returns the product of a and b
double division(int a, int b) - returns the result of dividing a by b
double percent(int a, int b) - returns b as a percentage of a
*/
public class Calculator {
public static int plus(int a, int b) {
//write your code here
return (a + b);
}
public static int minus(int a, int b) {
//write your code here
return (a - b);
}
public static int multiply(int a, int b) {
//write your code here
return (a * b);
}
public static double division(int a, int b) {
//write your code here
return ((double)a / (double)b);
}
public static double percent(int a, int b) {
//write your code here
double c = (double)b % (double)a;
return (c);
}
public static void main(String[] args) {
System.out.println(Calculator.percent(5, 2));
}
}