Directions: You will write a menu driven program in C that simulates an online coffee shop application. Many food industries allow you to order online through your smart phone. In these applications, you can order food, view your account balance, reload account balance, and much more. In this large programming assignment, you write a simple console coffee shop application.

The program will have the following setup.

  • The program will first welcome the user with a friendly message. It will provide the user with instructions on how the program works.
  • The program will be menu driven. This means the program will display a list of options of what the user would like to do. From the list of options, the user will select one of the following options.
    • User will be able to view your account balance. This will tell the user how much money is in your account. When the program starts for the first time, the user will have $0.00.
    • User will be able to order an item (food/drink). Note: In order for the user to make a purchase, the program must make sure the account balance will be able to handle the transaction. If not, the user will have to make sure to reload the account balance until enough money is added to make the purchase.
    • User will be able to view the menu items along with its respective prices.
    • User will be able to reload the account balance.
    • User will be able to exit the program.

In order to create this program, you will use the following function prototypes.

void Greeting(void); //welcome the user to the coffee shop
void Order (double *balance); //user will make a purchase
void ViewAccount(double *balance); //display current account balance of user
void Transaction(double *balance, double price); //transaction with user account
void Reload(double *balance); //reload your account balance with three options
void DisplayMenu(void); //display beverage/food options and prices
void SaveBalance (double *balance); // Before terminating program, balance is saved in a text file

You cannot add any additional functions or remove them. Modifying them in any way (name, parameters, etc...) will result in point deductions! Utilize them the way they are provided!

The function prototypes are provided for you here. You will create a file called Large Program2_lastnamefirstname.c for this assignment and write out the code. Do NOT modify any of the function prototypes that are provided for you! Any modifications from the provided function prototypes will result in points being deducted! You are allowed to use the same message that is provided in the sample output for your program. You can also make modifications to the text of messages as long as the program follows all directions as stated in this assignment.

Here is the order of steps I would strongly consider when attempting the large program assignment. After each of these steps, see if your program builds/compiles successfully and performs the correct task. See if the output is what you were expecting.

1. Start with the Message Greeting. Try to get the program to welcome the user.

2. After a successful message greeting, try to design menu driven component. Hint: Think of how to use a while loop and switch statement.

3. After getting the menu working. Work on the display menu function to display all food/beverage prices. Note. This is different from menu that shows user options of what they can do.

4. After getting the display menu function working, work on the view account summary function.

5. After getting the view account summary, work on the reload function to increase your account balance.

6. After getting the reload function to work, begin the ordering function. This is where the user will pick an item to purchase and make a transaction.

7. Test your program with different inputs to see if it works successfully.

8. OPTIONAL BONUS: Before program terminates, save balance into a text file.

Here are some tips and tricks that will help you with this assignment and make the experience enjoyable.

  • Do not try to write out all the code and build it at the end to find syntax errors. For each new line of code written (my rule of thumb is 2-3 lines), build it to see if it compiles successfully. It will go a long way!
  • After any successful build, run the code to see what happens and what current state you are at with the program writing so you know what to do next! If the program performs what you expected, you can then move onto the next step of the code writing. If you try to write everything at once and build it successfully to find out it doesn't work properly, you will get frustrated trying to find out the logical error in your code! Remember, logical errors are the hardest to fix and identify in a program!
  • Start the assignment early! Do not wait last minute (the day of) to begin the assignment.

Here is a sample output of the fully working program.

Welcome to the Palm Beach State College Coffee Shop!
We serve delicious coffee and snacks!
How can we help you today?
Please select one of the following options.
O: Order
V: View Account Summary
D: Display Menu
R: Reload Account
E: Exit
************************************************************
Please select what you like to do.
Option Selected: v

************************************************************
You selected View Account Summary Option.
Here is your current account balance.
You have $0.00 in your account.
************************************************************

Please select one of the following options.
O: Order
V: View Account Summary
D: Display Menu
R: Reload Account
E: Exit
************************************************************
Please select what you like to do.
Option Selected: D

************************************************************
You have selected Display Menu Option.
Here are the options!
************************************************************
1. Hot Coffee $3.53
2. Iced Coffee $4.20
3. Hot Latte $3.13
4. Iced Latte $4.12
5. Bagel (includes cream cheese) $3.99
6. Big Scone $4.99
7. Frozen Coffee $5.03
8. Bottle Water $1.50
************************************************************

Please select one of the following options.
O: Order
V: View Account Summary
D: Display Menu
R: Reload Account
E: Exit
************************************************************
Please select what you like to do.
Option Selected: o

************************************************************
You have selected the Order Option.
Here are the options.
Here are the options!
************************************************************
1. Hot Coffee $3.53
2. Iced Coffee $4.20
3. Hot Latte $3.13
4. Iced Latte $4.12
5. Bagel (includes cream cheese) $3.99
6. Big Scone $4.99
7. Frozen Coffee $5.03
8. Bottle Water $1.50
What would you like today?Option Selected: 2
Iced Coffee has been selected. Total cost is $4.20
Beginning Transaction Process.
You do not have enough in your account.
Please reload your account.
How much would you like to reload to your account?
1: $1.00
2: $5.00
3: $10.00
Option Selected: 2
$5.00 has been added to your account successfully!
Billing $4.20 to your account.
Transaction was successful!
You now have $0.80 in your account balance.
************************************************************

Please select one of the following options.
O: Order
V: View Account Summary
D: Display Menu
R: Reload Account
E: Exit
************************************************************
Please select what you like to do.
Option Selected: R

************************************************************
You have selected Reload Account option.
How much would you like to reload to your account?
1: $1.00
2: $5.00
3: $10.00
Option Selected: 3
$10.00 has been added to your account successfully!
************************************************************

Please select one of the following options.
O: Order
V: View Account Summary
D: Display Menu
R: Reload Account
E: Exit
************************************************************
Please select what you like to do.
Option Selected: V

************************************************************
You selected View Account Summary Option.
Here is your current account balance.
You have $10.80 in your account.
************************************************************

Please select one of the following options.
O: Order
V: View Account Summary
D: Display Menu
R: Reload Account
E: Exit
************************************************************
Please select what you like to do.
Option Selected: O

************************************************************
You have selected the Order Option.
Here are the options.
Here are the options!
************************************************************
1. Hot Coffee $3.53
2. Iced Coffee $4.20
3. Hot Latte $3.13
4. Iced Latte $4.12
5. Bagel (includes cream cheese) $3.99
6. Big Scone $4.99
7. Frozen Coffee $5.03
8. Bottle Water $1.50
What would you like today?Option Selected: 5
Bagel (includes cream cheese) has been selected. Total cost is $3.99
Beginning Transaction Process.
Billing $3.99 to your account.
Transaction was successful!
You now have $6.81 in your account balance.
************************************************************

Please select one of the following options.
O: Order
V: View Account Summary
D: Display Menu
R: Reload Account
E: Exit
************************************************************
Please select what you like to do.
Option Selected: E

************************************************************
Thank you for visiting our coffee shop!
You have $6.81 in your account.
Have a great day!
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.