Language is in Java and using BlueJ: Item.java code: /*** Item.java - implementation of an Item to be placed in ShoppingCart*/public class Item{ private String name; private int price; //in cents...

Language is in Java and using BlueJ:
Item.java code:
/*** Item.java - implementation of an Item to be placed in ShoppingCart*/public class Item{ private String name; private int price; //in cents //Constructor public Item(String n, int p) { name = n; price = p; } public boolean equals(Item other) { return this.name.equals(other.name) && this.price == other.price; } //displays name of item and price in properly formatted manner public String toString() { return name + ", price: $" + price/100 + "." + price%100; } //Getter methods public int getPrice() { return price; }public String getName(){return name;}}


Microsoft Word - 01.docx Programming Assignment #01 – Implementing a Shopping Cart Due: Tuesday, October 6th at 5:00 PM You must upload a single ZIP file containing all of your JAVA source code files on the course Moodle site by the start of class on the due date. Create a ShoppingCart class that simulates the operation of a shopping cart. The ShoppingCart instance should contain a BagInterface implementation that will serve to hold the Items that will be added to the cart. Use the implementation of the Item object provided in Item.java. Note that the price is stored as the number of cents so it can be represented as an int (e.g., an Item worth $19.99 would have price = 1999). Your shopping cart should support the following operations:  Add an item  Add multiple quantities of a given item (e.g., add 3 of Item __)  Remove an unspecified item  Remove a specified item  Checkout – should "scan" each Item in the shopping cart (and display its information), sum up the total cost and display the total cost  Check budget – Given a budget amount, check to see if the budget is large enough to pay for everything in the cart. If not, remove an Item from the shopping cart, one at a time, until under budget. Write a driver program to test out your ShoppingCart implementation. Note that your implementation should be as generalized as possible. In other words, you should be able to create a ShoppingCart instance using any of the bag implementations and have all of the methods still work. Also, think before you code. If you find yourself re-writing the substantive bag operations, you are doing it wrong. And of course, your code should be documented with header comments for each method and in-line comments as needed. Upload your source code files (.java files) to the course Moodle.
Sep 29, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here