Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write in C Code At the dinner of the wedding reception, Arup and his fianc e have decided that they will offer their guests the
Write in C Code
At the dinner of the wedding reception, Arup and his fiance have decided that they will offer their guests the choice between chicken and steak for their entrees. Naturally, the chicken costs less than the steak, so Arups secret desire is that everyone orders chicken so that he can pocket the extra money to buy some Dolphins tickets. Your job will be to write a program that helps him figure out the minimum number of guests who have to order chicken for the total meal cost to be at or below a particular threshold. For example, if the chicken costs $person the steak costs $person there are guests, and the designated target value was $ then at least people must order the chicken. To see this,
note that if people order the chicken, the total cost is:
x $ x $ $ which is under the target.
If only people order the chicken, the cost is:
x $ x $ $ which exceeds our target of $
Implementation Requirements
Loops have not yet been taught in the course. Do NOT use a loop to solve this problem. Doing
so will result in the automatic loss of points.
Input Specification
The cost of the chicken in dollars will be a positive integer less than
The cost of the steak in dollars will be a positive integer greater than the cost of the chicken
and less than
The number of guests will be a positive integer greater than and less than
The designated target value in dollars will be an integer greater than the cost of all guests
ordering chicken and less than the cost of all guests ordering beef.
Output Specification
Output the minimum number of guests who must order chicken for the total cost of the meals to
be less than or equal to the designated target:
You need at least X guests to order the chicken.
where X is the number of guests in question.
Output Samples
A sample output of running the program is included below. Note that this sample is NOT a
comprehensive test. You should test your program with different data than is shown here based
on the specifications given above.
Sample Run #
What is the cost of the chicken, in dollars?
What is the cost of the beef, in dollars?
How many guests will there be
What is your spending limit for food, in dollars?
You need at least guests
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