Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming Project Instructions Complete the following programming project according to the given specifications. You may need to review concepts from several units of the course

Programming Project Instructions Complete the following programming project according to the given specifications. You may need to review concepts from several units of the course to implement all functionality of this project. Grocery Store Application You are to create a grocery store application that uses Object Oriented Programming techniques. All classes should contain (at a minimum) private data members, public accessor and mutator methods for all the private data members (use enumerated types where appropriate), public constructors (default, parameter, and copy). Only class accessor methods for the private data members may be declared inline. Implement friend functions and overloaded operators as needed. In addition to general C++ programming constructs, you will be graded on the application of Object Oriented Programming constructs to add any class methods that are appropriate and reasonable for your problem implementation. Create a GrItem class that contains only the following private data members: Data Member Data Type Description name C++ string name of product quantity integer number of items purchased regular price floating point suggested retail price sale price floating point product sale price on sale Boolean flag indicating whether product is on sale or not tax category enumerated type category used to determine the items tax rate (alcohol, food, general merchandise, or medicine) Tax rates for the enumerated tax category type are (these should be static GrItem constants): Tax Category Tax Rate alcohol 8% food 5% general merchandise 7% medicine 4% The program should perform the following listed activities for full possible credit: create an array of objects to contain all the grocery items read from a file (maximum 20). Alternatively, you may use the STL vector container instead of a fixed size array. Online CIS2541 3 Programming Project Assignment prompt the user for a grocery item file name. Output an error message and exit with return error code of -1 for any file open errors. read the grocery items from file into the array of objects (until all items are read or the maximum number of array elements have been read, whichever comes first). If the STL vector container is used, read until the end of file. Close the file after reading is complete. sort the array of grocery items by product name (use one of the sorting algorithms covered in the course; do not use built-in sorting libraries). If the STL vector container is used, you may use the STL sort algorithm (http://www.cplusplus.com/reference/algorithm/sort/) providing the appropriate operator(s) have been overloaded for the GrItem class. process the sorted array of grocery items and produce a receipt (to the screen or file, your choice) create a generalized header for the receipt with the following information: o name and address of the grocery store o column headers for the detailed data lines produce detailed data lines on the receipt for each grocery item that includes the following: o name of grocery item o quantity of grocery item o price of grocery item (regular or sale, if item is currently on sale receipt should indicate whether sale price is displayed) o total cost of grocery item (quantity times price) display descriptive summary lines on the receipt that includes the following: o total before tax o total tax amount for each category o total after tax o customer savings (total of all differences between regular price and sale price for items that are currently on sale)Use the instructor provided Grocery.txt data file when creating and testing your program. It includes data in the following format, each item on a single line: Name Quantity Regular Price Sale Price On Sale Tax Category All-Natural Yogurt 12 0.99 0.59 Y food Oat Cereal 1 4.99 2.49 N food Golden Tequila (1.75L) 1 35.99 24.99 Y alcohol Full Body Shampoo 3 3.99 3.19 Y general merchandise First Aid Ointment 2 4.79 3.99 N medicine Alkaline Batteries (8pk AA) 1 7.99 5.99 N general merchandise Ibuprofen 1 4.99 4.49 Y medicine Cherry Soda 6 1.25 0.89 Y food Draft Beer 12-pack 2 13.49 10.99 N alcohol Laundry Detergent 1 12.59 9.99 N general merchandise Apples (3 lb bag) 1 5.29 4.25 Y food Notebook Paper 2 1.29 0.99 N general merchandise Your submitted program will be tested with data files containing different amounts of data, but in the same format. It should produce summary results that follow the listed requirements. Verify that your submitted programming project includes the following: Receipt output should have text output left aligned and numeric output right aligned. Floating point output should have 2 digits of precision displayed after the decimal. Only member functions and manipulators should be used to control input and output formatting. No spaces or tabs should be used in literalstrings to control output formatting. Add a multi-line header comment at the top of each source code file that identifies the file name, your name, date, and a short description of the overall file contents and/or program function. Include function headers to document functions with name, parameters, return values, and short description.

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

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions

Question

Know how to find a consultant

Answered: 1 week ago