Hi, I can't pass requirements parts with dividing and calculating percent. I've tried few different approaches, but nothing seems to be working here.
Could anybody have a look at it and tell me what am I doing wrong?
package pl.codegym.task.task06.task0612;
/*
Kalkulator
*/
public class Kalkulator {
public static int plus(int a, int b) {
//tutaj wpisz swój kod
int sum = a + b;
return sum;
}
public static int minus(int a, int b) {
//tutaj wpisz swój kod
int sub = a - b;
return sub;
}
public static int multiply(int a, int b) {
//tutaj wpisz swój kod
int mul = a * b;
return mul;
}
public static double divide(int a, int b) {
//tutaj wpisz swój kod
if(b > 0) {
double div = a / b;
return div;
} else {
return 0;
}
}
public static double percent(int a, int b) {
//tutaj wpisz swój kod
if(a > 0) {
double per = (b/a)*100;
return per;
} else {
return 0;
}
}
public static void main(String[] args) {
}
}