, a new Discount store, opens with a special on their high quality chopped meat,
ID: 3563029 • Letter: #
Question
, a new Discount store, opens with a special on their high quality chopped meat, designed to lure their customers into buying larger quantities.
Their cost per pound for the first three pounds is $6.50 per pound.
For orders that exceed three pounds but is less than nine pounds, the cost is $6.50 for the first three pounds and $5.25 per every pound in excess of three pounds.
For orders that exceed nine pounds, the cost is $5.50 for the first three pounds, $5.25 for the next six pounds, and $5.00 per every pound in excess of nine pounds.
Ask the user for the desired weight of meat to buy, calculate the total cost, display the weight and cost. Use appropriate labels, units, and formatting.
For those who are devout vegetarians, if you have difficulty dealing with meat, substitute really expensive bulgur wheat.
Explanation / Answer
#include <stdio.h>
int main()
{
int quantity_choppedmeat;
scanf("%d",&quantity_choppedmeat);
float Price;
if(quantity_choppedmeat<=3)
{
Price = quantity_choppedmeat*6.50;
}
if(3<quantity_choppedmeat<9)
{
Price = 3*6.50 + (quantity_choppedmeat-3)*5.50;
}
if(quantity_choppedmeat>=9)
{
Price = 5.50*3 + 5.25*6 + (quantity_choppedmeat-9)*5.00;
}
printf("%d%,%.2f",quantity_choppedmeat,Price);
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.