Latest Tutorials| Questions and Answers|Ask Questions?|Site Map

Home Answers Viewqa Java-Interview-Questions why the occupancy rate is zero?

View Questions and Answers by Category


Have Programming Question? Ask it here!

why the occupancy rate is zero?
1 Answer(s)      6 years and a month 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.

Related Tutorials/Questions & Answers: