Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ShoppingCartDriver class In a separate class, implement a test program (called a driver) to do the following actions: Create two ShoppingCarts with your choice of

ShoppingCartDriver class

In a separate class, implement a test program (called a driver) to do the following actions:

  • Create two ShoppingCarts with your choice of customer names.
  • Add at least three GroceryItems to the first ShoppingCart and at least five GroceryItems to the second ShoppingCart.
  • Test the special case where the GroceryItem has already been added (add() causes the existing item's quantity to be changed).
  • Test the special case where the array is too full to add another item.
  • Print both invoices in a nicely formatted output.
  • Your driver should also test all the methods in the ShoppingCart class (see p. 26-29 for a discussion of good testing).
  • Do not use a Scanner to read any inputs from the user. Instead, use hard coded values for the different methods' inputs.

Other Requirements

  • Draw a UML structure diagram showing the relationship between the classes in your solution. You may hand draw or use any tool of your choice but the diagram must be submitted in a format that I can read (one of .docx, .pdf, .jpg, .txt). If I cannot read it, I cannot grade it.
  • Draw a UML class diagram for your ShoppingCart class (may be combined with the structure diagram).
  • Note that automated tools often do not follow the conventions that I require.
  • Factor the classes as described above GroceryItem, ShoppingCart and ShoppingCartDriver are all in separate classes with private instance variables
  • Constants are normally declared as public
  • Comment the GroceryItem and ShoppingCart classes with Javadocs style comments (see Appendix H).
  • Use good coding style throughout (see slide deck 01-D Objects and Chapter 1 of your text) including
    • correct private/public access modifiers
    • consistent indenting
    • meaningful variable names
    • normal capitalization conventions
    • other aspects of easy-to-read code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

=+ Are there additional forms of employee representation?

Answered: 1 week ago

Question

=+What is the nature of their impact?

Answered: 1 week ago