COP3223 Program #4: Food and More Food!!! solution

$12.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (1 vote)

Program #4: Food and More Food!!!
Part A: Ichiban Buffet (buffet.c)
Since Arup doesn’t have class in person on Tuesdays and Thursdays, he’s been going out to
lunch more often this semester. His friend Merrill just started working near UCF and loves sushi.
In particular, Merrill loves cheap sushi. Every time they go out to eat for lunch, they go to
Ichiban’s buffet. Arup would like for you to write a program that calculates how much money
he’s saved on a trip to Ichiban. In order to solve the problem, you need to use the following
constants:
#define BUFFET_PRICE 9.05
#define SALMON_VALUE 0.75
#define VOLCANO_VALUE 1.25
In particular, the cost of the buffet is one flat fee that is $9.05 total (after tax has been added).
For the purposes of the problem, we’ll assume that each piece of a salmon roll would regularly
cost 75 cents and each piece of a volcano roll would regularly cost $1.25.
Since these are his two favorite items, this is all he eats every time he visits Ichiban. The only
difference between trips is how many pieces of each he eats. In your program, prompt the user
for how many pieces of each roll he’s eaten, and then print out how much money he’s saved.
Note: You’re guaranteed that the value of the rolls he’s eaten will ALWAYS exceed $9.05, since
Arup’s always after a good deal.
Sample Program Run
How many salmon roll pieces did you eat?
5
How many volcano roll pieces did you eat?
10
You saved $7.20.
Part B: Menchies (yogurt.c)
Arup often takes his step-daughter to Menchie’s, a place that serves frozen yogurt.
Unfortunately, his wife has put the two of them on a fixed budget for frozen yogurt. In addition,
he insists that since his step-daughter is smaller than he, he must get some multiple more frozen
yogurt than she gets. (For example, if the multiple is 1.5 and she gets 2 oz. of yogurt, then he will
get 3 oz.) The price of frozen yogurt at Menchie’s is 49 cents/ounce plus tax. For the purposes of
this program, assume a 6.5% sales tax rate. (In reality, tax gets rounded up to the nearest penny,
but don’t worry about this detail for this problem.) Write a program to determine how many
ounces of yogurt both Arup and his step-daughter can get. In your program, prompt the user to
enter the following two items:
1) The total amount of cash Arup has for the Menchie’s visit.
2) The ratio of yogurt that Arup receives to what his step-daughter receives.
Using this information, determine, rounded to two decimal places, the number of ounces of
frozen yogurt both Arup and his step-daughter can get. Both input values will be real numbers in
between 1 and 20.
Sample Program Run
How many dollars do you have for frozen yogurt?
6.50
What is the ratio of yogurt that you’ll get to your child?
1.5
You will get 7.47 ounces of yogurt.
Your child will get 4.98 ounces of yogurt.
Explanation of the sample: 4.98 x 1.5 = 7.47, so the ratio is accurate in the sample. 7.47 + 4.98 =
12.45 oz. purchased total. The price of 12.45 oz before tax is 12.45 x 0.49 = $6.1005. Adding
tax, we get $6.1005 x 1.065 = $6.4970325, which rounds to $6.50. If we had printed the ounces
to more precision, we would have seen the values 7.473412 oz. and 4.982275 oz. respectively.
Using these values and working the example forward, we get much closer to $6.50.)
Deliverables
Two source files: buffet.c, for your solution to problem A and yogurt.c for your solution to
problem B. All files are to be submitted over WebCourses.
Restrictions
Although you may use other compilers, your program must compile in gcc and run in the
Code::Blocks environment. Each of your two programs should include a header comment with
the following information: your name, course number, section number, assignment title, and
date. Also, make sure you include comments throughout your code describing the major steps in
solving the problem. Make sure to use good programming style, including use of
appropriate constants, good variable names and good use of white space. A significant
portion of your grade will be based upon programming style and not correctness. Of
course, a significant portion of your grade will also be based upon correctness.