Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello and thank you! (TCO 2) Given the following program description, • identify

ID: 2246566 • Letter: H

Question

Hello and thank you!

(TCO 2) Given the following program description,

• identify the required classes/objects necessary to achieve the program requirements;
• briefly describe any relationships that might exist between your classes; and
• briefly describe the overall hierarchy of your proposed classes.

Program Description - You have been asked to create a program designed to ring up orders in any store. The program must create a new electronic "shopping cart" with a unique ID that can be associated with a specific customer. The shopping cart must accept any number of items including both taxable and non-taxable items, and it should calculate the tax on the order and display the final price.

Explanation / Answer

Based on the given program description, following classes and objects are required:

Class Item :

A typical class that stores the information related to a particular item such as name, product ID, price, etc. It must also have relevent methods to utilize these values, like returning price or product ID. Each object of this class represents an item.

Class ShoppingCart :

This class is the basis of the program. Each object of this class represents an independent shopping cart associated with every unique customer. Again, this class must have a variable to store "Customer Number" which must be unique for every object of this type. This class must also have an array of objects of type "Item" (which we just discussed) to store various items that the customer buy. A variable to store final price based on the price and tax on each item which can be accessed for each object in array of "Item"s.

Relation and hierarchy between classes : As we can see, the Shopping Cart class uses the objects of class Item. Thus the class Item is independent and more primitive. It is not necessary that some class inherit from another class for this program. But we can define a new class called "Customer" whose each object stores a unique ID (unique for every new customer) and then let the Shopping Cart class inherit from the Customer class so that each object of class Customer can have a Shopping Cart object associated with it.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote