Answered step by step
Verified Expert Solution
Question
1 Approved Answer
LANGUGE IS JAVA, i have most of the code right but for the last input i dont know why i get that error. the instructor
LANGUGE IS JAVA, i have most of the code right but for the last input i dont know why i get that error. the instructor gave me the soltuion but i dont know how to implement it. need output to be exactly as expected output.
(1) Create two files to submit: Item ToPurchase.java - Class definition ShoppingCartPrinter.java - Contains main0 methood Build the ItemToPurchase class with the following specifications: Private fields String itemName- Initialized in default constructor to "none" int itemPrice - Initialized in default constructor to 0 int itemQuantity-initialized in default constructor to 0 Default constructor Public member methods (mutators & accessors) setName & getName0 (2 pts) setPrice0 & getPrice0 (2 pts) setQuantity0 & getQuantity0 (2 pts) . (2) In main0, prompt the user for two items and create two objects of the ItemToPurchase class. Before prompting for the second item, call scnr.nextLine0; to allow the user to input a new string. (2 pts) Ex: Item 1 Enter the item name: Chocolate Chips Enter the item price: 3 Enter the item quantity: Item 2 Enter the item name: Bottled Water Enter the item priceStep 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