Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Output items available for purchase
- String[] csuStore = {"bookbag", "textbook", "notebook", "pen", "pencil", "sweatpants", "shirt", "sweater", "candy", "planner"};
- System.out.println("Textbook: $50");
- System.out.println("Bookbag: $40");
- System.out.println("Sweatpants: $35");
- System.out.println("Sweater: $30");
- System.out.println("Shirt: $25");
- System.out.println("Planner: $15");
- System.out.println("Notebook: $3");
- System.out.println("Candy: $2");
- System.out.println("Pen: $1");
- System.out.println("Pencil: $1");
- // Ask how many items the customer would like to purchase.
- System.out.print("Enter how many items you would like to purchase: ");
- int items = Integer.parseInt(input.nextLine());
- if (items == 0) {
- System.out.println("Have a great day, come again soon!");
- if (items > 10)
- System.out.println("You're buying too much! Please decide on less than 10 items.");
- }
- // Have user to enter names of items they would like to purchase
- String arrayOfItems[] = new String[items];
- for (int i = 0; i < arrayOfItems.length; i++) {
- System.out.print("Enter the name of item #" + (i+1) + " : ");
- arrayOfItems[i] = input.nextLine();
- }
- //Items purchased
- for (int i = 0; i < arrayOfItems.length; i++) {
- System.out.print("Items being purchased " + (i+1) + " : ");
- System.out.print(arrayOfItems[i] + "n");
- }
Add Comment
Please, Sign In to add comment