CS 144 Programming Problem 4: Amazon Books Design And Implem

Cs 144 Programming Problem 4amazon Booksdesign And Implement A C Pro

Design and implement a C++ program to buy books on Amazon. The program should be menu based with options to enter customer name, add books to a customer's shopping cart, display the shopping cart, search for books, list all books, and checkout. It should read initial inventory from a file and support searching by keyword, listing all books, adding books to a customer's cart, and displaying a receipt upon checkout. A Customer class will manage customer info and the shopping cart, including functions to enter a name, add books, and display the cart with total price. The main program will manage the menu and coordinate these actions, supporting multiple customers, and ensuring proper display and functionality as per requirements.

Sample Paper For Above instruction

The rapid growth of online shopping platforms like Amazon has necessitated sophisticated software systems capable of managing large inventories, customer data, and transactional operations efficiently. To simulate such a system, developing a comprehensive C++ program that encompasses product management, customer interactions, and checkout procedures is essential. This paper presents a detailed implementation of a C++ shopping application that aligns with real-world online book purchasing scenarios. It highlights the modular design approach, particularly the use of classes such as Book and Customer, to facilitate code reusability, readability, and maintainability.

The core of the application revolves around managing a collection of books, which serves as the inventory. The system begins by reading book data from an external text file, “Books.txt,” which contains essential details like titles, authors, formats, and prices. This initial inventory setup ensures that the program can dynamically handle different book collections without hardcoding data. The program employs an array of Book objects to represent the inventory, allowing efficient access and manipulation of book data throughout the session.

A pivotal feature of the system is its menu-driven interface, which guides the user through various operations. The main menu offers six options:

  1. Enter Customer Name
  2. Add a Book to Customer’s Shopping Cart
  3. Display Customer’s Shopping Cart
  4. Search for Books
  5. List All Books
  6. Checkout

The modular design entails implementing separate functions for each menu option. For instance, entering a customer’s name involves a straightforward function that prompts the user and stores the input within a Customer object. Adding books requires a search mechanism within the inventory based on user input, followed by invoking the Customer’s method to add the selected book to their shopping cart. Displaying the shopping cart involves listing all books added alongside the total price, which is calculated through an internal method within the Customer class.

The Customer class encapsulates customer-specific data, including the name, mailing address (if desired), a container (array) to hold their selected books, and a count of items. The class provides methods to set the customer’s name, add books to the cart, and display the cart’s contents, including a running total. These methods promote encapsulation and facilitate easy updates or modifications in customer data management.

The search functionality scans the inventory for keywords matching the title, author, or format. All matching books are displayed, aiding customers in selecting desired items accurately. The listing feature outputs the entire inventory, formatted neatly for readability. Both functionalities utilize separate functions to maintain code clarity.

Checkout consolidates the customer’s order, presenting a detailed receipt with their name, list of books purchased, and the total amount. This process demonstrates object-oriented principles by leveraging the Customer’s methods to generate the receipt, ensuring modularity. Before program termination, the system prompts for a pause to review the receipt, offering a user-friendly experience.

The program can be extended by adding features such as removing books from the cart or saving shopping data for future sessions. Proper commenting, indentation, and descriptive variable names are emphasized to enhance code quality. The project is designed to be submitted as a zipped folder containing all source files—Book.h, Book.cpp, Customer.h, Customer.cpp, and Shopping.cpp—each adhering to coding standards and demonstrating functional correctness.

In conclusion, this implementation encapsulates essential e-commerce operations within a structured, object-oriented C++ framework. It accurately models a typical online bookstore experience by integrating inventory management, customer interactions, and transactional processing, thereby providing a robust foundation for further enhancements and real-world application development.

References

  • Stroustrup, B. (2013). The C++ Programming Language. 4th Edition. Addison-Wesley.
  • Gaddis, T. (2018). Starting Out with C++: From Control Structures through Objects. 9th Edition. Pearson.
  • Deitel, P. J., & Deitel, H. M. (2017). C++ How to Program. 10th Edition. Pearson.
  • Lippman, S. B., Lajoie, J., & Moo, B. E. (2012). C++ Primer. 5th Edition. Addison-Wesley.
  • Stroustrup, B. (2018). The Design and Evolution of C++. Addison-Wesley.
  • ISO/IEC 14882:2017(E). Programming languages — C++. International Organization for Standardization.
  • C++ Reference Documentation. (2023). cppreference.com. Retrieved from https://en.cppreference.com/
  • TutorialsPoint. (2023). C++ Programming Language. Retrieved from https://www.tutorialspoint.com/cplusplus/index.htm
  • GeeksforGeeks. (2023). Object-Oriented Programming in C++. Retrieved from https://www.geeksforgeeks.org/object-oriented-programming-in-cpp/
  • Effective C++: 55 Specific Ways to Improve Your Programs and Designs by Scott Meyers. (2005). Addison-Wesley.