(using java btw)
Basically I was calculating the percentage of expense by taking the rent(for instance) and divided it by the total revenue. They were all declared as integers to start.
Ex. rent = 250
revenue = 1500
Code: Select all
rentExpense = (rent / revenue) * 100
That was the problem I was trying to complete. I started by using (double) and (int) in front of the numbers to covert them but they came out as 16 in the end(or 16.66). But my teacher wanted it round to 17 (as an integer).
So I would try stuff like this:
Code: Select all
rentExpense = (int)((double)(rent / revenue) * 100);
I know she wants me to have problem solving skills but I was trying to figure it out for 1.5 hours. It's not just going to come to me.
Help a bro out?