Purchase Solution

Java Program for Representing Shopping Carts

Not what you're looking for?

Ask Custom Question

JAVA. Write a class representing a line item in a shopping cart:

The characteristics of this class are the name of the product, the cost per unit, and the number of items. This class is named LineItem.Provide a constructor that takes 3 arguments, and initializes the corresponding instance variables. Provide the assessors to the 3 instance variables.
Write a class representing a shopping cart: a shopping cart contains a list of line item objects. This class is named ShoppingCart: provide a constructor for this class, a method to add a line item object to it, and a method printing out its content, with the total cost adding up the cost of all line items.

Write a test program that creates 2 shopping carts, and asks the user to input the content of each shopping cart. Once the user is done inputting the content of the shopping carts, the program displays their contents with their cost.

The programs should compile and run without errors.

Test the program and provide a list of comprehensive test cases used to validate the application and include these test cases in a word document containing all UML diagrams and descriptions. The test data can be shown in a table that includes input data, expected output, actual output and pass/fail results from the test.

Purchase this Solution

Solution Summary

This posting contains the solution to the given problem regarding a program in Java.

Purchase this Solution

Free BrainMass Quizzes
C++ Operators

This quiz tests a student's knowledge about C++ operators.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Basic Networking Questions

This quiz consists of some basic networking questions.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.