C++ applications.

Concepts tested by this project

• Loops
• File processing
• Previously mastered course topics

Beverage Orders

A high-end coffee shop has just hired you as their senior programmer. They have tasked you to design and implement two C++ applications allowing employees to take orders from its customers and to determine weekly sales.

Application #1: Create an application allowing employees to take orders and then tally up the total costs from its customers.

The coffee shop offers the following items on its menu:
• Coffee
• Tea
• Soda
• Juice
• Manager Special (store manager offers a drink of their choice to customers)

The application must be able to:
• Accept one or more drinks in a single order; use a sentinel value to terminate an order
• Once an order has been placed, tally up the total cost of the order

Application #2: Create another application to process an input file, weekly_sales.txt, and tally up its weekly sales total. The data file consists of 7 entries representing the sales from last week.

If the input file does not exist, prompt user to try again.


Project Requirements

• Proper formatting must be utilized. For example, currency format was be used for any order amount.
• Data validations
o When an order for coffee is placed, the application should accept ‘c’ or ‘C’. See sample run.
o When an invalid menu item is entered, the application should ignore it. ‘w’ or ‘W’ should be ignored.
• If the weekly sales data file is not available, display an appropriate error message. DON’T crash the program.
• Be sure to thoroughly test both applications – valid and invalid test cases must be included.
• Be sure to review the provided rubric so that you understand the project’s expectations in regard to documentation, CMSC140, and programming requirements.
• Not clear or need clarifications? Seek help from your instructor. “I did not know …” or “I did not understand …” is not going to cut it.

In addition to completing the applications, a write-up is required. At a minimal, the write-up should include:
• Project Design / Algorithm
o A list of detailed steps to capture the design of each application
o Students should complete this step first, and then write your code
• Test Plan/ Test Cases (be sure to include a table of your test cases. Your instructor will look for them)
o I want to see your “thinking,” as to how you are testing your program.
• Screen shots capturing some of your test runs (just like the provided sample runs)
• Any assumptions that you are making
• Highlights of your learning experience. Very important, as your instructor is interested in what you have done, how you did it, etc.
o Anything else that you want to share with the instructor


Submission Requirements

Each student must submit one compressed (zip) file (back) to the assignment’s folder on Blackboard with the following project artifacts:
• Your projects’ folders – Your instructor MUST BE able to compile and test (the actual code of) each submitted program (
o For this project, you should have worked on two separate folders for the two programs under Visual Studio
• Project Write-up (in a Word document)
• The compressed file must be named as <firstname_initial_lastname_project_x> where x is the project number and your name (i.e., gthai_project_4.zip)

Academic Integrity Policy reminder – Each submitted project will be compared against others’ submissions from current and previous semesters.


Sample Runs

Below are sample runs for the 1st applications. Yours should be similar but should not be exactly the same.



Instructor’s comment: Each order must also be saved to an output file.

Here are the sample runs for the 2nd applications. Yours should be similar but should not be exactly the same.

About to process weekly sales
There are 7 entries, and the total was $628.83

About to process weekly sales
Could not open file. Exiting program.

To complete this project, you will need to design and implement two C++ applications. The first application allows employees to take orders and tally up the total costs from customers. The second application processes an input file, "weekly_sales.txt", and tallies up the weekly sales total.

For the first application, here are the steps to capture its design:

1. Define the menu items: Coffee, Tea, Soda, Juice, and Manager Special.
2. Implement a loop for taking orders. Inside the loop, prompt the employee to enter a drink choice.
3. Validate the drink choice entered by the employee. Only accept 'c' or 'C' for Coffee, 't' or 'T' for Tea, 's' or 'S' for Soda, 'j' or 'J' for Juice, and 'm' or 'M' for Manager Special. Ignore any invalid input.
4. If the drink choice is valid, calculate and store the cost of the order.
5. Allow the employee to enter multiple drinks in a single order until they enter a sentinel value to terminate the order.
6. Once the order is complete, tally up the total cost of the order and display it in currency format.
7. Save each order to an output file.

For the second application, here are the steps to capture its design:

1. Implement file processing to read the "weekly_sales.txt" file.
2. Check if the file exists. If it doesn't exist, display an appropriate error message and exit the program.
3. If the file exists, open it for reading.
4. Read each entry in the file, representing the sales from the previous week.
5. Tally up the total sales from the entries.
6. Display the total sales in currency format.

When testing both applications, make sure to include valid and invalid test cases. For example, test ordering different drinks, ordering the same drink multiple times, and entering invalid menu items. Also, test the second application by providing both a valid and invalid "weekly_sales.txt" file.

In your write-up, include the project design/algorithms, a test plan with test cases, screenshots of test runs, any assumptions you made, and highlights of your learning experience or any other information you want to share with your instructor.

To submit your project, compress all the project folders, the project write-up, and name the compressed file according to the provided submission requirements.

Good luck with your project! If you have any further questions, feel free to ask.

To complete this project, you need to design and implement two C++ applications: one for taking orders from customers, and another for processing sales data from a file. Here are the steps to capturing the design of each application:

Application #1: Taking Orders
1. Start by defining the menu items offered by the coffee shop: Coffee, Tea, Soda, Juice, and Manager Special.
2. Prompt the employee to enter an order by selecting the menu items. Use a sentinel value to terminate the order.
3. Validate the input and ignore any invalid menu items.
4. Calculate the total cost of the order by summing up the prices of the selected items.
5. Display the total cost of the order using proper formatting, such as currency format.
6. Save each order to an output file.

Application #2: Processing Sales Data
1. Prompt the user for the name of the input file, which should be "weekly_sales.txt".
2. Attempt to open the input file. If it fails, display an appropriate error message and exit the program.
3. Read the sales data from the input file. There will be 7 entries representing the sales from the last week.
4. Calculate the total sales by summing up the sales amounts from the data file.
5. Display the total sales with proper formatting, such as currency format.

To thoroughly test both applications, you should include valid and invalid test cases. Here is an example test plan:

Test Plan/ Test Cases:
1. Valid Test Case - Taking Orders:
- Enter the following drink orders: Coffee, Tea, Soda, Juice, Manager Special.
- Verify that the total cost is calculated correctly.
- Verify that the order is saved to the output file.

2. Valid Test Case - Processing Sales Data:
- Ensure that the input file "weekly_sales.txt" exists.
- Verify that the total sales from the file is calculated correctly.

3. Invalid Test Case - Taking Orders:
- Enter an invalid menu item, such as 'w' or 'W', and verify that it is ignored.
- Enter an invalid input for the order quantity, such as a negative number, and verify that it is ignored.

4. Invalid Test Case - Processing Sales Data:
- Ensure that the input file does not exist and verify that an appropriate error message is displayed.

You should also include screen shots capturing some of your test runs, just like the provided sample runs. Additionally, include any assumptions you are making and highlight your learning experience.

Remember to provide proper documentation, a test plan with test cases, and the actual code for each program. Submit all the project artifacts in a compressed (zip) file with the proper naming convention.

If you have any further questions or need clarification on any specific steps, feel free to ask!