<PG3302 23H> - [Software Design Exam 2023]
A program that simulates an online store.
- A user is presented with a console based menu that they navigate by entering the number corresponding to the action they wish to take.
- A user can register as a user by choosing
Sign upin the main menu. - A registered user can add products to their shopping cart by choosing either
See all waresorSearch for itemwhen logged in. - When
See all waresorSearch for itemis chosen the user is asked to enter the id corresponding to the product they want, followed by the ammount they want. - A registered user can view their cart by choosing
View Cartfrom the menu. - A registered user can place their order by choosing
Checkoutin the menu. - To exit the store there are two ways. If you are :
Signed inyou chooseLog outfrom the menu and thenExit.signed outyou chooseExitfrom the menu.
- To populate the database with dummy data uncomment the
StoreController storeController = new();,TestRunner testRunner = new();andtestRunner.Run(storeController);methods from Main().
- The program persists users and items in a SqLite database and keeps a log of the users purchase history.
- The method responsible for handeling the checkout is multithreaded with
parallel.foreachin order to mitigate conflicting changes made to the database. - The creation of
shopping cartsanditemsare handled by factory methods. - The database layer follows the
Dependency Inversion Principleand can therefor be changed for other databases.