Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA PROGRAMMERS ONLY(Try programming it) Hello, I don't have time to finish this assignment but I will learn it from understanding what the compiler is
JAVA PROGRAMMERS ONLY(Try programming it)
Hello, I don't have time to finish this assignment but I will learn it from understanding what the compiler is trying to say can someone fix this issue?
I'm only having a hard time understanding the printMenu() method and the executeMenu() method in the ShoppingCartManager.java
7: Unit test A 0/1 Test printMenu(). Should output the menu options. Compilation failed zyLabsUnitTest.java:18: error: method printMenu in class ShoppingCartM ShoppingCartManager.printMenu(); Compilation failed required: ShoppingCart found: no arguments reason: actual and formal argument lists differ in length 1 error 8: Unit test A 0/1 Test executeMenu('o', myCart, scnr). Should output "OUTPUT SHOPPING CART John Doe's Shopping Cart - February 1, 2016 Number of Items: O SHOPPING CART IS EMPTY Total: $0" Compilation failed zyLabsUnitTest.java:22: error: cannot find symbol ShoppingCartManager.executeMenu(usroption, myCart, scnr); Compilation failed symbol: method executeMenu (char, ShoppingCart, Scanner) location: class Shopping CartManager error 1 LAB*: Program: Online shopping cart (Part 2) Note: Creating multiple Scanner objects for the same input stream yields unexpected behavior. Thus, as good practice is to use a single Scanner object for reading input from System.in. That Scanner object can be passed as an argument to any methods that read input. This program extends the earlier "Online shopping cart" program. (Consider first saving your earlier program). (1) Extend the ItemToPurchase class per the following specifications: Private fields o string itemDescription - Initialized in default constructor to "none" Parameterized constructor to assign item name, item description, item price, and item quantity (default values of 0) (1 pt) . Public member methods o setDescription() mutator & getDescription() accessor (2 pts) print temCost() - Outputs the item name followed by the quantity, price, and subtotal o print temDescription - Outputs the item name and description Ex. of printItemCost() output: Bottled Water 10 @ $1 = $10 Ex. of printitem Description() output: Bottled Water: Deer Park, 12 oz. (2) Create two new files: Shopping Cart.java -Class definition Shopping CartManager.java - Contains main() method Build the Shopping Cart class with the following specifications. Note: Some can be method stubs (empty methods) initially, to be completed in later steps Private fields String customerName - Initialized in default constructor to "none" String currentDate - Initialized in default constructor to "January 1, 2016" ArrayList cartitems Default constructor Parameterized constructor which takes the customer name and date as parameters (1 pt) Public member methods getCustomerName() accessor (1 pt) o getDate() accessor (1 pt) additem( Adds an item to cartitems array. Has a parameter of type ItemToPurchase. Does not return anything. o removeltem Removes item from cartitems array. Has a string (an item's name) parameter. Does not return anything. If item name cannot be found, output this message: Item not found in cart. Nothing removed. o modifyltem Modifies an item's description price, and/or quantity. Has a parameter of type ItemToPurchase. Does not return anything. . If item can be found (by name) in cart, check if parameter has default values for description, price, and quantity. If not, modify item in cart . If item cannot be found (by name) in cart, output this message: Item not found in cart. Nothing modified. getNumitemsInCart() (2 pts) . Returns quantity of all items in cart. Has no parameters, getCostOfCart0 (2 pts) Determines and returns the total cost of items in cart. Has no parameters. printTotal Outputs total of objects in cart. . If cart is empty, output this message: SHOPPING CART IS EMPTY printDescriptions Outputs each item's description Ex. of print Total output: John Doe's Shopping Cart - February 1, 2016 Number of Items: 8 Nike Romaleos 2 @ $189 = $378 Chocolate Chips 5 @ $3 = $15 Powerbeats 2 Headphones i @ $128 = $128 Total: $521 Ex. of printDescriptions() output: John Doe's Shopping Cart - February 1, 2016 Item Descriptions Nike Romaleos: Volt color, Weightlifting shoes Chocolate Chips: Semi-sweet Powerbeats 2 Headphones: Bluetooth headphones (3) In main, prompt the user for a customer's name and today's date. Output the name and date. Create an object of type Shopping Cart. (1 pt) Ex: Enter Customer's Name : John Doe Enter Today's Date: February 1, 2016 Customer Name: John Doe Today's Date: February 1, 2016 (4) Implement the printMenu() method in the Shopping Cart Manager class to print the following menu of options to manipulate the shopping cart. (1 pt) Ex: MENU c Add item to cart d - Remove item from cart Change item quantity i - Output items' descriptions O - Output shopping cart g Quit (5) Implement the executeMenu() method in the ShoppingCartManager class that takes 3 parameters: a character representing the user's choice, a shopping cart, and a Scanner object. executeMenuo performs the menu options described below, according to the user's choice. (1 pt) (6) In main(), call printMenu() and prompt for the user's choice of menu options. Each option is represented by a single character. If an invalid character is entered, continue to prompt for a valid choice. When a valid option is entered, execute the option by calling executeMenu(). Then, print the menu and prompt for a new option. Continue until the user enters 'q'. Hint: Implement Quit before implementing other options. (1 pt) EX: C a - Add item to cart d - Remove item from cart Change item quantity i - Output items' descriptions 0 - Output shopping cart q - Quit Choose an option: (7) Implement Output shopping cart menu option in executeMenu() (3 pts) Ex: OUTPUT SHOPPING CART John Doe's Shopping Cart - February 1, 2016 Number of Items: 8 Nike Romaleos 2 @ $189 = $378 Chocolate chips 5 @ $3 = $15 Powerbeats 2 Headphones 1 @ $128 = $128 Total: $521 (8) Implement Output item's description menu option in execute Menu(). (2 pts) Ex: OUTPUT ITEMS' DESCRIPTIONS John Doe's Shopping Cart - February 1, 2016 Item Descriptions Nike Romaleos: Volt color, Weightlifting shoes Chocolate Chips: Semi-sweet Powerbeats 2 Headphones: Bluetooth headphones (9) Implement Add item to cart menu option in executeMenu() (3 pts) Ex: ADD ITEM TO CART Enter the item name: Nike Romaleos Enter the item description: Volt color, Weightlifting shoes Enter the item price: 100 (9) Implement Add item to cart menu option in execute Menu() (3 pts) Ex: ADD ITEM TO CART Enter the item name: Nike Romaleos Enter the item description: Volt color, Weightlifting shoes Enter the item price: 189 Enter the item quantity: 2 (10) Implement Remove item menu option in executeMenu(). (4 pts) Ex: REMOVE ITEM FROM CART Enter name of item to remove: Chocolate Chips (11) Implement Change item quantity menu option in executeMenu(). Hint: Make new Item To Purchase object and use Item ToPurchase modifiers before using modifyltem() method. (5 pts) Ex: CHANGE ITEM QUANTITY Enter the item name: Nike Romaleos Enter the new quantity: 3
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started