Create a program that will allow me to enter the weight of a


Create a program that will allow me to enter the weight of a single item as well as the quantity of that item to be shipped. Calculate and display the total shipping charges on the package using the following table. For example, if the user enters an item weight of 1 pound and the quantity of that item as 5, then the total weight would be 5 pounds so you would tell them that it will cost $7,00 to ship their items.

Solution

#include <stdio.h>
#include <stdlib.h>
int main( ) {

   double w;//Weight of the item
   int n;//Number of items
   double weight;
   int shipping;//Shipping costs


   printf( \"Enter the weight of the item in lb:\");
   scanf(\"%lf\", &w);

   printf( \"Enter the number of items:\");
   scanf(\"%d\", &n);

   weight=w*n;//Calculate the weight of the package

   if (weight<5)
   {
    shipping=5;
   }
   else if (weight>=5 && weight<=10)
   {
    shipping=7;
   }
   else if (weight>10)
   {
    shipping=10;
   }

   printf(\"The shipping cost is=%d dollars\ \",shipping);
   return 0;
}

 Create a program that will allow me to enter the weight of a single item as well as the quantity of that item to be shipped. Calculate and display the total sh

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site