COP3223 Assignment #2 Program A: Go­Karting (karting.c): solution

$24.99

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

Description

5/5 - (1 vote)

Program A: Go­Karting (karting.c):
You and your friends want to go go­karting! Given the price per hour and the number of
minutes you are able to spend there, report the cost you will spend. Note: because go­kart
places all want to make money, they will all round up to the nearest whole number of hours to
calculate your cost.
Sample Run (User input in bold and italics):
How much does this go­kart location charge per hour?
10.99
How many minutes can you spend there?
30
Your total will be $10.99.
Sample Run (User input in bold and italics):
How much does this go­kart location charge per hour?
5.30
How many minutes can you spend there?
120
Your total will be $10.60.
Program B: Powerup Purchases (powerups.c):
Steve has just discovered that his favorite game has an option to purchase powerups using
in­game credits. Steve is super excited about this, as this is way easier than spending all his
time checking every hiding place in every level to find them. But before he rushes into clicking
the “purchase” button and regretting his choice, he wants to make sure he spends his credits
right.
Steve has narrowed his choices to two different types of powerups (his two favorites). He
wants to buy as many of these as possible using the credits he currently has. But he realized
that there may be many different ways of splitting the money between the two types of
powerups he wants to purchase. So he’s decided that his goal should be to maximize the total
number of powerups he gets.
Write a program that will ask Steve for the cost of his two favorite powerups (in positive whole
numbers of credits) and how many credits he has currently, then tell him the greatest number
of powerups he can purchase and the greatest number of credits he can have left over after
doing so.
Sample Run (User input in bold and italics):
How much does the first powerup cost (in credits)?
12
How much does the second powerup cost (in credits)?
7
How many credits do you currently have?
62
You can purchase a maximum of 8 powerups, with 6 credits left over.
Note: different inputs to this program may result in different behaviors. Make sure you test
other cases to make sure your program behaves as expected in these other cases.
Program C: Widget Discounts (discounts.c):
Nick recently opened a widget store. This store sells widgets, widgets, and more widgets (and
nothing else), so he figured it would be quite simple. However, at the end of his first month, he
totaled up his profits and realized they are negative. Oh no!
Looking down his totals, he eventually figured out why: his discounts to some of his more
loyal customers have been too high. You see, Nick loves all of his customers. But he
especially loves the ones that buy the most. He considers 3 sizes of purchases:
Less than 100 widgets Small
Between 100 and 500 widgets Medium
More than 500 widgets Large
When someone buys a small number of widgets, they pay normal price. When someone buys
a medium number of widgets, Nick is quite happy, and gives them a discount off of the normal
price. When someone buys a large number of widgets, Nick falls in love with them, and gives
them an even bigger discount off of the normal price! But his problem is this: sometimes these
amounts are lower than his original costs, so he loses money on the sale!
For simplicity, we will assume that each widget costs Nick $0.40 each (so he should be selling
each of them for a higher cost than this to his customers):
#define WIDGET_COST 0.40
To help Nick save his business, please write a program that will prompt him for the price he
will sell each widget for, the percent he will discount medium purchases by, and the percent
he will discount large purchases by (each as whole numbers of a percent), then will output a
message indicating which of these choices is causing him not to make a profit. The possible
issues Nick could have are (output only the first in this list that is true):
1.Nick, your base price is too low!
2.Nick, you are discounting medium purchases too much!
3.Nick, you are discounting large purchases too much!
If there are no issues with his prices, you should just output:
All prices look good to me!
After outputting the appropriate message from above, don’t forget to wish Nick good luck with
his new business:
Good luck!
Sample Run (User input in bold and italics):
How much are you selling each widget for?
1.00
What percent are you discounting medium orders?
10
What percent are you discounting large orders?
20
All prices look good to me!
Good luck!
Sample Run (User input in bold and italics):
How much are you selling each widget for?
2.00
What percent are you discounting medium orders?
80
What percent are you discounting large orders?
90
Nick, you are discounting medium purchases too much!
Good luck!
Deliverables:
Please submit three separate .c files for your solutions to these problems via WebCourses by
the designated due date:
Program A: karting.c
Program B: powerups.c
Program C: discounts.c