You are viewing our Forum Archives. To view or take place in current topics click here.
Problem solved now thanks
Posted:
Problem solved now thanksPosted:
Status: Offline
Joined: Dec 24, 201112Year Member
Posts: 83
Reputation Power: 2
Problem has been solved
Thanks for your help
(Thread can be deleted)
Last edited by hudd123 ; edited 1 time in total
Thanks for your help
(Thread can be deleted)
Last edited by hudd123 ; edited 1 time in total
#2. Posted:
Status: Offline
Joined: Jun 11, 200915Year Member
Posts: 9,897
Reputation Power: 3160
Motto: "I'l no I grew up to fast speed I no u will be little famous" - Famous_Energy
Motto: "I'l no I grew up to fast speed I no u will be little famous" - Famous_Energy
Status: Offline
Joined: Jun 11, 200915Year Member
Posts: 9,897
Reputation Power: 3160
Motto: "I'l no I grew up to fast speed I no u will be little famous" - Famous_Energy
You have several issues here.
"remainingSpaces" is never initialized with a value, so the above loop will never run.
Same thing here. You also cannot decrement a variable that has not been given a value. This would also cause an infinite loop if "spaces" was ever > 0, because you're decrementing "remainingSpaces" and leaving "spaces" unchanged.
CarPark = new CarPark();
while (CarPark.getspaces() > 0){
protected int RemaingSpaces;
"remainingSpaces" is never initialized with a value, so the above loop will never run.
while (spaces > 0);
--RemaingSpaces;
Same thing here. You also cannot decrement a variable that has not been given a value. This would also cause an infinite loop if "spaces" was ever > 0, because you're decrementing "remainingSpaces" and leaving "spaces" unchanged.
- 0useful
- 0not useful
You are viewing our Forum Archives. To view or take place in current topics click here.