Sale!

TCES203 Assignment  5  –  Multiple  Classes solved

$24.99 $14.99

Original Work ?

Download Details:

  • Name: Assignment_5-1.zip
  • Type: zip
  • Size: 256.39 KB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (5 votes)

This assignment tests your understanding of concepts covered in the course dealing with classes. For this assignment, you have to create two classes with the corresponding header and implementation files as well as a test file that contains the main function. The GroceryItemOrder class should store an item’s name, quantity and price per unit. A GroceryItemOrder object should have the following functions and any necessary accessors: • A constructor that creates an item order to purchase the item with the given name, in the given quantity, which costs the given price per unit. The name must be a cstring. • A function that returns the total cost of this item in its given quantity. For example, 4 boxes of cookies that are 2.30 per unit have a cost of 9.20. • A function that sets this grocery item’s quantity to be the given value. • A destructor that deallocates any dynamic memory. Test the GroceryItemOrder class first before moving onto the next class. The GroceryList represents a person’s list of items to buy from the market, and another class named GroceryItemOrder that represents a request to purchase a particular item in a given quantity (example: 4 boxes of cookies). The GroceryList class should use an array field to store the grocery items, as well as keeping track of its size (number of items in the list so far). Assume that a grocery list will have no more than 10 items. A GroceryList object should have the following functions: • A constructor that creates a new empty grocery list. • A function to add the given item order to this list, if the list is not full (has fewer than 10 items). This function must take an object of type GroceryItemOrder as a parameter by reference. • A function that returns the total sum cost of all grocery item orders in this list. No parameters can be passed to this function. • A destructor that deallocates any dynamic memory. Test the functions of the GroceryList class.
Submission and Grading: Submit GroceryItemOrder.h, GroceryItemOrder.cpp, GroceryList.h, GroceryList.cpp and main.cpp under the Assignments section of the course web page as one zip file with the name Grocery