I am rather new to programming, I have done for loops before, but I can't see why this doesn't work.
The following program is a fare calculator which I have been practicing on, I would really appreciate if someone could explain why this loop is printing "Add another drop-off point?" then breaking the loop after that and proceeding too the next section of code.
for (int i = 0; i < 4; i++) { System.out.print("\nAdd another drop-off point? "); mulDropOff = scan.nextLine().toLowerCase().trim(); if (mulDropOff.equals("yes") || mulDropOff.equals("y")) { System.out.print("\nEnter drop off point: "); nextDropOff = scan.nextLine().toLowerCase().trim(); addDropOff = addDropOff + nextDropOff; sur = sur + 5.0; System.out.print("\nEnter extra distance (in km): "); addDist = scan.nextDouble(); dist = dist + addDist; } else { break; } }