Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Project 2, Program Design 1. (60 points) A u-pick farm allows customers to pick four different berry products in their farm. The prices are: 1.
Project 2, Program Design 1. (60 points) A u-pick farm allows customers to pick four different berry products in their farm. The prices are: 1. strawberry - $1.99/1b, 2. blueberry - $4.39/1b, 3. blackberry $3.69/1b, 4. raspberry - $5.99/1b. Write a program that allows the user to select products, input the weights of each product, and calculate the total amount due. The farm only accepts cash. Your program will take input of the cash received and calculate the change. A sample input/output: Please select a product: 1. strawberry - $1.99/lb, 2. blueberry - $4.39/lb, 3. blackberry $3.69/lb, 4. raspberry - $5.99/lb. Enter 0 to stop selection. Enter product selection: 1 Enter product weight (lb): 4.8 Enter product selection: 3 Enter product weight (lb): 2 Enter product selection: 7 Invalid selection, select from 1 to 5, enter 0 to stop selection Enter product selection: 4 Enter product weight (lb): 1.6 Enter product selection: 0 Amount due ($): 15.96 Enter cash received ($): 20 Your change is $4.04 1) Name your program berries.c 2) If the user selects a number out of the range (1 through 4), 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 product selection
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started