# Why raiseSalary equation can't work? empolyee.java

• March 7th, 2014, 06:02 AM
kennylty
Why raiseSalary equation can't work? empolyee.java
why in raiseSalary(): salary *= (100 + percent) / 100 won't work?

Code java:

```  // why salary *= (100+percent)/100 wont work? }public void raiseSalary(int percent){ salary = salary*(100+percent)/100;```
• March 7th, 2014, 06:19 AM
GregBrannon
Re: Why raiseSalary equation can't work? empolyee.java
Simplify the equation in the method to see if you can answer your own question. When you've obtained the simplified equation, don't forget to apply the rules of 'integer math.'
• March 7th, 2014, 06:56 AM
kennylty
Re: Why raiseSalary equation can't work? empolyee.java
Quote:

Originally Posted by GregBrannon
Simplify the equation in the method to see if you can answer your own question. When you've obtained the simplified equation, don't forget to apply the rules of 'integer math.'

I am able to do it by adding a (double). thanks for the help.

Code java:

``` }public void raiseSalary(int percent){ salary *= (double)(100+percent)/100;```