Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You need to design, implement, and test a grocery shopping list program. The program should maintain and display a list of items. You will use

You need to design, implement, and test a grocery shopping list program. The program should maintain and display a list of items.

You will use a class for the Items. The class should have data elements for the following information: item name, unit (i.e. can, box, pounds, or ounces), number to buy, and unit price. Do you need any functions other than the constructor(s)? How do you calculate the extended price for the item (number to by times unit price? How do you print it to the screen?

You will also need a List class. You will store Item objects in your List object. As each item is entered an Item object must created and added to the List object. Use a dynamic array to hold the Item objects. The dynamic array should start with a capacity of 4 Item objects. Do you need a print function in this class?

NOTE: A vector is not a dynamic array.

Your program must perform the following activities: create a list, add items, remove items, and display the shopping list. To add an item you should prompt the user to enter the name, unit of sale, the number needed, and the unit price. The display should show: each item in the list, the number of items, the unit of sale, the unit price, the extended price for each item, and the total price for all items. Oregon doesnt have a sales tax so you can ignore that. Debug and test your program.

Once you have the List and Item classes working correctly, test if an item is already in your List before adding it. Overload the == operator to perform the test. There is a simple example to overload this operator in the book. Keep it simple. How will you compare items? You can assume that the user will type the information in correctly.

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

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago