Guest User

Untitled

a guest
Oct 22nd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.52 KB | None | 0 0
  1. // Output items available for purchase
  2. String[] csuStore = {"bookbag", "textbook", "notebook", "pen", "pencil", "sweatpants", "shirt", "sweater", "candy", "planner"};
  3. System.out.println("Textbook: $50");
  4. System.out.println("Bookbag: $40");
  5. System.out.println("Sweatpants: $35");
  6. System.out.println("Sweater: $30");
  7. System.out.println("Shirt: $25");
  8. System.out.println("Planner: $15");
  9. System.out.println("Notebook: $3");
  10. System.out.println("Candy: $2");
  11. System.out.println("Pen: $1");
  12. System.out.println("Pencil: $1");
  13.  
  14. // Ask how many items the customer would like to purchase.
  15. System.out.print("Enter how many items you would like to purchase: ");
  16. int items = Integer.parseInt(input.nextLine());
  17. if (items == 0) {
  18. System.out.println("Have a great day, come again soon!");
  19. if (items > 10)
  20. System.out.println("You're buying too much! Please decide on less than 10 items.");
  21. }
  22.  
  23. // Have user to enter names of items they would like to purchase
  24. String arrayOfItems[] = new String[items];
  25. for (int i = 0; i < arrayOfItems.length; i++) {
  26. System.out.print("Enter the name of item #" + (i+1) + " : ");
  27. arrayOfItems[i] = input.nextLine();
  28. }
  29. //Items purchased
  30. for (int i = 0; i < arrayOfItems.length; i++) {
  31. System.out.print("Items being purchased " + (i+1) + " : ");
  32. System.out.print(arrayOfItems[i] + "n");
  33. }
Add Comment
Please, Sign In to add comment