Advertisement
Guest User

Untitled

a guest
Feb 7th, 2016
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. int i = 0;
  2. do {
  3. System.out.print("Please enter the product ID to purchase.");
  4. String orderItem = input.nextLine();
  5. if (orderItem.toUpperCase() == "13WB") {
  6. orderNum[i] = productIDs[0];
  7. }
  8. else if (orderItem.toUpperCase() == "18WB") {
  9. orderNum[i] = productIDs[1];
  10. }
  11. else if (orderItem.toUpperCase() == "23WB") {
  12. orderNum[i] = productIDs[2];
  13. }
  14. else {
  15. System.out.print ("Error. Please enter a product ID.");
  16. orderItem = input.nextLine();
  17. }
  18. System.out.println(orderNum[i]);
  19. System.out.println("You entered product ID: " + orderItem);
  20. i ++;
  21. System.out.print("Would you like to order another item? \n"
  22. + "Enter 'y' for yes, 'n' for no.");
  23. doAnother = input.nextLine();
  24. }
  25.  
  26. while (i < SIZE && doAnother.toLowerCase() == "y");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement