Answered step by step
Verified Expert Solution
Link Copied!

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 $40/person, the steak costs $50/person, there are 200 guests, and the designated target value was $9059, then at least 95 people must order the chicken. To see this,
note that if 95 people order the chicken, the total cost is:
95 x $40+105 x $50= $9050, which is under the target.
If only 94 people order the chicken, the cost is:
94 x $40+106 x $50= $9060, which exceeds our target of $9059.
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 20 points.
Input Specification
1. The cost of the chicken (in dollars) will be a positive integer less than 100.
2. The cost of the steak (in dollars) will be a positive integer greater than the cost of the chicken
and less than 100.
3. The number of guests will be a positive integer greater than 10 and less than 1000.
4. 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 #1
What is the cost of the chicken, in dollars?
40
What is the cost of the beef, in dollars?
50
How many guests will there be?
200
What is your spending limit for food, in dollars?
9059
You need at least 95 guests

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Design With Microcomputer Applications

Authors: Glenn A. Jackson

1st Edition

0137718411, 978-0137718412

More Books

Students also viewed these Databases questions

Question

8. Explain the relationship between communication and context.

Answered: 1 week ago

Question

d. How were you expected to contribute to family life?

Answered: 1 week ago