Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help with my CPSC131 Project. Below is the description and requirement of the project. 1. A class named Groceryltem. You will reuse this

I need help with my CPSC131 Project. Below is the description and requirement of the project.

image text in transcribed

image text in transcribed

image text in transcribed

1. A class named Groceryltem. You will reuse this class in future homework assignments, so effort you apply getting it right now will greatly benefit you later. a. Attributes i. Product Name the name of the product (Ex: Heinz Tomato Ketchup - 2 Ct, Boston Market Spaghetti With Meatballs) ii. Brand Name - the product manufacture's brand name (Ex: Heinz, Boston Market) iii. UPC - a 14-digit Universal Product Code uniquely identifying this item (Ex: 00051600080015, 05017402006207). Code this as a string type, not an integral type. iv. Price - the cost of the item in US Dollars (Ex: 2.29, 1.19). Code this as type double. b. Construction i. Allow grocery items to be constructed with zero, one, two, three, or four arguments?. The first argument must be the product name, the second the brand name, the third the UPC, and the fourth the price. ii. Initialize each attribute with member initialization? and in the constructor's initialization list3. Do not set the attribute's value in the body of the constructor. C. Operations i. Set and retrieve each of the attributes. Name your overloaded functions upcCode, brandName, productName, and price. For example: void upcCode ( const std::string & upcCode); //mutate std::string upcCode () const; //query ii. Overload the insertion and extraction operators. For example, main() may read from standard input and write to standard output a Groceryltem object like this: GroceryItem groceryItem; std::cin >> groceryItem; // extraction (reading) std::cout > groceryItem; // extraction (reading) std::cout

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