Hi All. Wondering if someone can assist me with this code im trying to write. I have to make a small calculation with random variables but the problem i run into is that i have to pass the calculated variable back to the main method and display it that way. Im not very good with Java but im trying to learn. Here is what i have so far:
public class Calculator
{
public static void main(String[] args)
{
int price = 20000;
int commission = 10;
int discount = 15;
int endPrice;
endPrice = calculation(price);
System.out.println("The total price after a " + commission +
"% commission and a " + discount + "% discount is " + endPrice);
}
public static int calculation(int finalPrice)
{
int productPrice = 20000;
int withSalesCommission = productPrice * (10/100);
int withCustDiscount = productPrice * (15/100);
productPrice = withSalesCommission - withCustDiscount;
return productPrice;
}
}
When i run this it tells me that the endprice is equal to 0. I appreciate your help.
Sam