C++代写|CS代写|IT代写

CS3520 Programming in C++ 代写案例


Assignment 6

Objectives:

Understand how to work with Object-Oriented Design Design with UML Diagrams and CRC Cards
Understand how to templates

Submission:

Write a modular program, a program which uses appropriate functions to complete different tasks. Don’t write all the code in main function and organize your code in files properly. Be sure to make the code readable. Create a separate folder (named “hw6” or “assign6”) in your github repository and submit all of your source code (*.cpp and *.hpp and other files, if needed), along with appropriate Makefile(s). Submit the link to your github commit on Canvas. For design exercise, a doc/pdf file may also be submitted on Canvas.

Grading scheme: 65 pts

  • E#2 (Design): UML/CRC/Header: 30 pts

  • E#3 (Source Code): 35 pts

    Assignment Description

1. Designing a Food Ordering System

Design a program that simulates basic functions of a food ordering system. The system should offer options to different restaurants to publish their menus and also should allow customers to order food. Food delivery options should also be included. Customers may also create accounts to login and store their favorite food from different restaurants. Follow an object- oriented design approach that was discussed in the last few lectures and design your classes and their hierarchies using design principles (i.e., SOLID, KISS, DRY, YAGNI, etc.) Your design should have high cohesion and low coupling. Also, you will design API for your system i.e., your classes should include appropriately named members (variables and functions).

Note: This is a design exercise.

  • Choose 8-10 most important classes. Draw UML diagram for the software system (this will include most important class diagrams.

  • Draw at least 2 different class hierarchies or appropriate relationships

  • Draw sequence diagrams for the 3 most important features.

  • Create CRC Cards with important detail (responsibilities and collaborations) for these classes.

  • Then create your API which should include the header files with all designed classes properly declared (i.e., all member variables and all functions should be properly declared). No further coding is needed (i.e., don’t write definitions within any member functions. Only a brief comment should be sufficient).


Your design (UML diagrams, CRC Cards, and API) should include enough detail (and comments) that can help a programmer implement and test your program. Template for CRC cards can be found on Canvas.

Note: If you happen to be in a situation where you had to update UML diagrams and/or CRC cards while writing API, feel free to submit the final version of design. {This, by the way, is completely normal because design is always an iterative process}

2: Header-only Template-Based Repository

Write a template-based class that implements Repository System in a header only file. It could be a repository for a course {that you want to have taken}, or for a book {you want to borrow from the library} or for a file that you want to store or passwords that you may be using. The repository system has entries kept in the FIFO order. Each course or book will have some basic information like title, name, subject, id, etc. The id must be unique. Internally, you may represent the data using any data structure of your choice (e.g., list, vector, arrays, etc.) However, the API for your class should externally support the following functions:

  • Add a new item (movie/book/etc.) to the repository with some associated information. This associated information could be the semester when you took the course, the date when you borrowed the book, the date when file was saved or updated, the date when password was last used, etc. If the item is already in the repository, then previous information will be updated.

  • Add several items (i.e., list of items or set of items) to the repository. If any of these items is already in the repository, then the data for those items will be updated and others will be added.

  • Determine the order (or position) of the item if it is on the repository. Return -1 if not. Order could mean different things depending on the type of item being stored in repository.

  • Remove an item or several items from the repository (items may or may not be sorted).

  • Return the number of items in the repository

    Also, implement Rule of 5 special member functions for your classes. You could also overload insertion (<<) and extraction operators (>>) if you find it necessary. All of your implementation must use RAII design principle.

    Test your template-based class by creating at least four different sets of items with data types (e.g., Files, Books, string for your passwords, or other types) – may be two generic and two user- defined types. If you add objects to the repository then you may need to overload == and != operators for the object’s class so your template-based class can properly determine membership.

    For each data type, write a program that doesn’t prompt user input and shows output for each of the required behaviors (listed above) for each type. 


咨询 Alpha 小助手,获取更多课业帮助。