Name: new to c 2011-02-09 15:23
#include <stdio.h>
#define TAX_RATE 0.065
int main () {
double cost;
int quantity, taxed, weight, cost_with_shipping;
printf("What is the cost of the item to be purchased (in dollars)?\n");
scanf("%lf", &cost);
printf("What is te weight of the item (in pounds)?\n");
scanf("%d", & weight);
printf("How many of the item are you purchasing?\n");
scanf("%d", &quantity);
printf("Is the item a taxed item (1 = yes, 0 = no)?\n");
scanf("%d", & taxed);
if (weight > 0 && weight <= 10);
cost_with_shipping = (weight * 4) + cost;
double total_cost = cost_with_shipping*quantity*(1+ taxed*TAX_RATE);
printf("Your total purchase, with shipping, will cost $%.21f.\n", total_cost);
else (weight > 10 && weight <= 30);
cost_with_shipping = (weight * 2.5) + cost;
double total_cost = cost_with_shipping*quantity*(1+ taxed*TAX_RATE);
printf("Your total purchase, with shipping, will cost $%.21f.\n", total_cost);
else (weight > 30 && weight <= 50);
cost_with_shipping = (weight * 1.5) + cost;
double total_cost = cost_with_shipping*quantity*(1+ taxed*TAX_RATE);
printf("Your total purchase, with shipping, will cost $%.21f.\n", total_cost);
else (weight > 50);
cost_with_shipping = (weight * .99) + cost;
double total_cost = cost_with_shipping*quantity*(1+ taxed*TAX_RATE);
printf("Your total purchase, with shipping, will cost $%.21f.\n", total_cost);
system("PAUSE");
return 0;
}
#define TAX_RATE 0.065
int main () {
double cost;
int quantity, taxed, weight, cost_with_shipping;
printf("What is the cost of the item to be purchased (in dollars)?\n");
scanf("%lf", &cost);
printf("What is te weight of the item (in pounds)?\n");
scanf("%d", & weight);
printf("How many of the item are you purchasing?\n");
scanf("%d", &quantity);
printf("Is the item a taxed item (1 = yes, 0 = no)?\n");
scanf("%d", & taxed);
if (weight > 0 && weight <= 10);
cost_with_shipping = (weight * 4) + cost;
double total_cost = cost_with_shipping*quantity*(1+ taxed*TAX_RATE);
printf("Your total purchase, with shipping, will cost $%.21f.\n", total_cost);
else (weight > 10 && weight <= 30);
cost_with_shipping = (weight * 2.5) + cost;
double total_cost = cost_with_shipping*quantity*(1+ taxed*TAX_RATE);
printf("Your total purchase, with shipping, will cost $%.21f.\n", total_cost);
else (weight > 30 && weight <= 50);
cost_with_shipping = (weight * 1.5) + cost;
double total_cost = cost_with_shipping*quantity*(1+ taxed*TAX_RATE);
printf("Your total purchase, with shipping, will cost $%.21f.\n", total_cost);
else (weight > 50);
cost_with_shipping = (weight * .99) + cost;
double total_cost = cost_with_shipping*quantity*(1+ taxed*TAX_RATE);
printf("Your total purchase, with shipping, will cost $%.21f.\n", total_cost);
system("PAUSE");
return 0;
}