Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Cart ClassCart - databaseName: string + Cart ( ) : + Cart ( string databaseName ) + viewCart ( string userID, string inventoryDatabase ) :

Cart ClassCart- databaseName: string+ Cart():+ Cart(string databaseName)+ viewCart(string userID, string inventoryDatabase): void+ addToCart(string userID, string ISBN, int quantity): void+ removeFromCart(string userID, string ISBN): void+ checkOut(string userID): voidDescription:This handles all Cart interactions including interfacing with the Cart database defined below.Assumptions Made:Continuing from the previous classes, theres minimal class variables here. The Cart class hasthe user ID sent from the main (gathered from the User class) for a lot of the functionality tomake sure cart items are linked to the appropriate user. This is used as a parameter instead of aclass variable to aid in limited changes needing to occur upon logout of a user. So, it makes fora more seamless process.This also has the only instance of one class calling another relying on the Inventory class forsome of the functions.Finally, input and output is utilized in this class.Function Descriptions: Cart(): Zero constructor. Nothing needs to be initialized here, but it allows for thefunctions to be used. Cart(string databaseName): Initially sets up the database that will be used throughoutthe class to access the appropriate database tables viewCart(string userID, string inventoryDatabase): Displays all books in the logged inUsers cart. Please note: this cooperates with the inventory database to display all thecorrect information on the inventory items it just selectively shows the books in theUsers cart addToCart(string userID, string ISBN, int quantity): This relies on the user viewing theinventory previously from the main. Once they select a book, this ISBN is used to add

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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