why the occupancy rate is zero?
1 Answer(s)      7 years ago
Posted in : Java Interview Questions


View Answers

February 23, 2009 at 7:25 AM


I go through your code and found that you have to alter your code like this "occupancyRate= (double)totalOccupied / totalRooms;".
If you not parse the multiplication result of totalOccupied and totalRooms then you will get the result 0.0 becouse these two variable is integer type.When ever you perform multiplication between two integer values then you will get result in integer form.