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:

hudd123
  • Junior Member
Status: Offline
Joined: Dec 24, 201112Year Member
Posts: 83
Reputation Power: 2
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
#2. Posted:
speed
  • V5 Launch
Status: Offline
Joined: Jun 11, 200914Year 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, 200914Year 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.

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.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.