Question: Write the program in C 1. (50 points) Tessa has recently started a produce stand. The prices are: 1. Lemons - $0.21 each, 2. Lettuce

Write the program in C 1. (50 points) Tessa has recently starteda produce stand. The prices are: 1. Lemons - $0.21 each, 2.Lettuce - $2.39 each, 3. Potatoes $0.79/lb, 4. Beans - $0.99/lb, 5.Avocado - $1.50 each 6. Tomatoes - $1.99/1b Write a program toWrite the program in C

1. (50 points) Tessa has recently started a produce stand. The prices are: 1. Lemons - $0.21 each, 2. Lettuce - $2.39 each, 3. Potatoes $0.79/lb, 4. Beans - $0.99/lb, 5. Avocado - $1.50 each 6. Tomatoes - $1.99/1b Write a program to help Tessa calculate the charge. The program allows the user to select an item, input the weight or the number of items, and calculate the total amount due. Tessa only accepts cash. The program will take input of the cash received and calculate the change. An example input/output: Please select from the list: 1. Lemons - $0.21 each, 2. Lettuce - $2.39 each, 3. Potatoes $0.79/lb, 4. Beans - $0.99/lb, 5. Avocado - $1.50 each 6. Tomatoes - $1.99/lb Enter selection: 1 Enter number of items: 3 Enter selection: 3 Enter weight (lb): 2 Enter selection: 7 Invalid selection, select from 1 to 6, enter 0 to stop selection Enter selection: 4 Enter weight (lb): 1.6 Enter selection: 5 Enter number of items: 1 Enter product selection: 0 Amount due ($): 5.29 Enter cash received ($): 20 Your change is $14.71 1) Name your program produce_stand.c 2) If the user selects a number out of the range (1 through 6), display a message and allows the user to select again. When user enters 0, the program should exit from the loop for selection. 3) Use a switch statement to compute the amount due according to the selection(s). Programming Style Guidelines The major purpose of programming style guidelines is to make programs easy to read and understand. Good programming style helps make it possible for a person knowledgeable in the application area to quickly read a program and understand how it works. 1. Your program should begin with a comment that briefly summarizes what it does. This comment should also include your name. 2. In most cases, a function should have a brief comment above its definition describing what it does. Other than that, comments should be written only needed in order for a reader to understand what is happening. 3. Variable names and function names should be sufficiently descriptive that a knowledgeable reader can easily understand what the variable means and what the function does. If this is not possible, comments should be added to make the meaning clear. 4. Use consistent indentation to emphasize block structure. 5. Full line comments inside function bodies should conform to the indentation of the code where they appear. 6. Macro definitions (#define) should be used for defining symbolic names for numeric constants. For example: #define PI 3.141592 7. Use names of moderate length for variables. Most names should be between 2 and 12 letters long. 8. Use either underscores or capitalization for compound names for variable: tot vol, total_volumn, or totalVolumn. 1. (50 points) Tessa has recently started a produce stand. The prices are: 1. Lemons - $0.21 each, 2. Lettuce - $2.39 each, 3. Potatoes $0.79/lb, 4. Beans - $0.99/lb, 5. Avocado - $1.50 each 6. Tomatoes - $1.99/1b Write a program to help Tessa calculate the charge. The program allows the user to select an item, input the weight or the number of items, and calculate the total amount due. Tessa only accepts cash. The program will take input of the cash received and calculate the change. An example input/output: Please select from the list: 1. Lemons - $0.21 each, 2. Lettuce - $2.39 each, 3. Potatoes $0.79/lb, 4. Beans - $0.99/lb, 5. Avocado - $1.50 each 6. Tomatoes - $1.99/lb Enter selection: 1 Enter number of items: 3 Enter selection: 3 Enter weight (lb): 2 Enter selection: 7 Invalid selection, select from 1 to 6, enter 0 to stop selection Enter selection: 4 Enter weight (lb): 1.6 Enter selection: 5 Enter number of items: 1 Enter product selection: 0 Amount due ($): 5.29 Enter cash received ($): 20 Your change is $14.71 1) Name your program produce_stand.c 2) If the user selects a number out of the range (1 through 6), display a message and allows the user to select again. When user enters 0, the program should exit from the loop for selection. 3) Use a switch statement to compute the amount due according to the selection(s). Programming Style Guidelines The major purpose of programming style guidelines is to make programs easy to read and understand. Good programming style helps make it possible for a person knowledgeable in the application area to quickly read a program and understand how it works. 1. Your program should begin with a comment that briefly summarizes what it does. This comment should also include your name. 2. In most cases, a function should have a brief comment above its definition describing what it does. Other than that, comments should be written only needed in order for a reader to understand what is happening. 3. Variable names and function names should be sufficiently descriptive that a knowledgeable reader can easily understand what the variable means and what the function does. If this is not possible, comments should be added to make the meaning clear. 4. Use consistent indentation to emphasize block structure. 5. Full line comments inside function bodies should conform to the indentation of the code where they appear. 6. Macro definitions (#define) should be used for defining symbolic names for numeric constants. For example: #define PI 3.141592 7. Use names of moderate length for variables. Most names should be between 2 and 12 letters long. 8. Use either underscores or capitalization for compound names for variable: tot vol, total_volumn, or totalVolumn

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!