rayda
why the occupancy rate is zero?
1 Answer(s)      6 years and 5 months ago
Posted in : Java Interview Questions
Advertisement
View Answers

February 23, 2009 at 7:25 AM


Hello,

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.