• Loops

• File processing
• Previously mastered course topics

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.

To create an application allowing employees to take orders and tally up the total costs from customers, you can follow these steps:

1. Start by creating a data structure or data model to represent the menu items and their prices. For example, you can use a dictionary with the item name as the key and the price as the value.

2. Implement a loop structure, such as a while loop, to continuously accept orders until the user wants to terminate.

3. Inside the loop, prompt the user to enter a drink from the menu. You can display the menu options or use a predefined list of options.

4. Use conditional statements or switch cases to determine the price of the selected drink and add it to a running total.

5. If the user wants to terminate the order, implement a sentinel value (e.g., "quit" or "done") that will break out of the loop.

6. Once the loop is exited, display the total cost of the order to the user.

Now, let's move on to creating another application to process an input file, weekly_sales.txt, and tally up its weekly sales total:

1. Begin by checking if the input file, weekly_sales.txt, exists. You can use file handling techniques to accomplish this. If the file doesn't exist, prompt the user to try again.

2. Open the input file for reading, and use a loop structure to iterate through each line in the file.

3. Inside the loop, parse each line and extract the sales value. You can use string manipulation functions or regular expressions to achieve this, depending on the structure of the file.

4. Accumulate the sales values into a running total.

5. After processing all the lines in the file, close the file and display the weekly sales total to the user.

By following these steps, you can create the two applications as described in your scenario. Make sure to consider error handling and validation to handle any unexpected inputs or file errors.