D
Devin Panchal
hi,
i am making a program in blue j. it is about a hiring vans. wat i want to
do is;
when the mileage of the van gets to a certain number, i want the terminal
window to say 'the van is on hire'.
this is the follwing code i have created so far, but i cant get the else bit
to work.
public double getservice()
{
if (totalmileage >=10000 && totalmileage <= 10500)
serviceStatus = true;
System.out.println("Van is being serviced");
if (totalmileage >=20000 && totalmileage <= 20500)
System.out.println("Van is being serviced");
if (totalmileage >=30000 && totalmileage <= 30500)
System.out.println("Van is being serviced");
{
else (totalmileage >=0 && totalmileage <=10000)
}
System.out.println("Van does not need servicing")
return totalmileage;
}
how can i make this work? can somone rewrite the code? so it makes sense and
works? do i have to have it as a method? cant it be automatic? the
totalmileage is calculated when the van is hired and returned, as the
imleage is added to the totalmileage.
thanx
devin
i am making a program in blue j. it is about a hiring vans. wat i want to
do is;
when the mileage of the van gets to a certain number, i want the terminal
window to say 'the van is on hire'.
this is the follwing code i have created so far, but i cant get the else bit
to work.
public double getservice()
{
if (totalmileage >=10000 && totalmileage <= 10500)
serviceStatus = true;
System.out.println("Van is being serviced");
if (totalmileage >=20000 && totalmileage <= 20500)
System.out.println("Van is being serviced");
if (totalmileage >=30000 && totalmileage <= 30500)
System.out.println("Van is being serviced");
{
else (totalmileage >=0 && totalmileage <=10000)
}
System.out.println("Van does not need servicing")
return totalmileage;
}
how can i make this work? can somone rewrite the code? so it makes sense and
works? do i have to have it as a method? cant it be automatic? the
totalmileage is calculated when the van is hired and returned, as the
imleage is added to the totalmileage.
thanx
devin