public static boolean rentCar(String id) {
for (int i = 0; i < collection.size(); i++) {
return(
if (id.equals(Car.collection.elementAt(i).carTypeId)) {// if the id equals to the collection.elementAt(i).carTypeId;
System.out.println("Please insert the id number of the car you would like to rent>");
id = Keyboard.in.readString();
int quantity;
quantity = Car.collection.elementAt(i).carInventory;
if (quantity >0){
quantity--;
System.out.println("You have successfully rented " + Car.collection.elementAt(i).carType );
System.out.println("Drive Carefully! ");
System.out.println("Thanks for using the Low Budget Car Rental!");
}
else{
System.out.println("Sorry, this car is not currently available for renting.");
}
}
else {
System.out.println("Sorry the id number you have entered is invalid.");
}
);
}
}
Here I keep getting an erro saying that the method needs to return a boolean value even though I have. Can someone please point out where I am going wrong?
Thanks!