Please help me understand what to do with this problem?
The ABC Mail Order Grocery sells artichokes for $1.25 per pound, beets for .65 per pound, and carrots for .89 per pound. They give 5% discount for orders of $100 or more prior to adding shipping costs. They charge $3.50 shipping and handling for any order of 5 pounds or under, $10.00 shipping and handling for orders over 5 pounds and under 20 pounds, and $8.00 plus .10 per pound for shipments of 20 pounds or more. Write a program to ask the user to enter a single grocery item (a for artichokes, b for beets, and c for carrots) and the weight in pounds. The program then computes the subtotal, the discount, if any, the shipping charges, and the grand total. The program then should display the grocery item purchased, the cost per pound, the pounds ordered, the subtotal, the discount, the shpping charged, and the grand total. I have to run the program for 3 data sets a 100, b 5, and c 7.
I am having trouble with this problem. I can figure out for one data set, but not grasping how to include the others. Please help. This is what I have so far.
Code:
#include <stdio.h>
#define artichokes 1.25
#define beets .65
#define carrots .89
void main(void)
/* Declare and intialize variables */
{ int lbs;
float Sub_Total, Discount, Shipping, Grand_Total;
char item;
/* PrintOut */
printf("ABC Mail Order Company\n\n");
printf("Grocery items:\n");
printf(" a for artichokes\n");
printf(" b for beets\n");
printf(" c for carrots\n\n");
/* prompt user for input */
printf("Enter an item and the amount in lbs->");
scanf("%c %i", &item, &lbs);
printf("%i pounds of artichokes @ $%g per pound\n\n", lbs, artichokes);
Sub_Total = lbs * artichokes;
printf(" Sub Total: $ %6.2f\n", Sub_Total);
Discount = Sub_Total * .05;
printf(" Discount: - %6.2f\n", Discount);
Shipping = 8.00 + lbs * .10;
printf(" Shipping: %6.2f\n", Shipping);
printf(" -------------------------\n");
Grand_Total = Sub_Total - Discount + Shipping;
printf(" Grand Total: $ %6.2f\n", Grand_Total);
}