So the program skips the final if statement, which is causing the program to set the coffee to the base price instead of prompting for another try if the value isn't in the array.
import java.util.Scanner; public class JumpinJive { public static void main(String args[]) throws Exception { // Declare variables. String addIn; // Add-in ordered by customer. final int NUM_ITEMS = 5; // Named constant // Initialized array of add-ins. String addIns[] = {"Cream", "Cinnamon", "Chocolate", "Amaretto", "Whiskey"}; // Initialized array of add-in prices. double addInPrices[] = {.89, .25, .59, 1.50, 1.75}; boolean foundIt = false; // Loop control variable. double orderTotal = 2.00; // All orders start with a 2.00 charge // Get user input. Scanner input = new Scanner(System.in); System.out.print("Enter coffee add-in or XXX to quit: "); addIn = input.nextLine(); // Write the rest of the program here. if(addIn != "XXX"){ for(int x=0; x<NUM_ITEMS; x++){ if(addIn.equals(addIns[x])){ System.out.println(addInPrices[x]); foundIt = true; orderTotal = orderTotal + addInPrices[x]; System.out.print("Enter coffee add-in or XXX to quit: "); addIn = input.nextLine(); } } if(foundIt = false){ System.out.println("Sorry, we do not carry that."); System.out.println("Enter coffee add-in or XXX to quit: "); addIn = input.nextLine(); } } System.out.println("Your order total is $" + orderTotal); } // End of main() method. } // End of JumpinJive class.