Ask Question
19 January, 14:20

Global Courier Services will ship your package based on how much it weighs and how far you are sending the package. Packages above 100 pounds will not be shipped. You need to write a program in C that calculates the shipping charge.

+2
Answers (1)
  1. 19 January, 16:11
    0
    The code will be:

    #include

    #include

    main () {

    double weight, shippingCharge, rate, segments;

    int distance;

    printf ("Enter the weight: / n");

    scanf ("%lf", &weight);

    printf ("Enter the distance: / n");

    scanf ("%i", &distance);

    if (weight < = 10) {

    printf ("Rate is $3.00 / n");

    rate = 3;

    } else {

    printf ("Rate is $5.00 / n");

    rate = 5;

    }

    if (distance % 500 = = 0) {

    segments = distance / 500;

    } else {

    segments = distance / 500 + 1;

    }

    shippingCharge = rate * segments;

    if (distance >1000) {

    shippingCharge = shippingCharge + 10;

    }

    printf ("Your shipping charge is $%lf/n", shippingCharge);

    system ("pause");

    }
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Global Courier Services will ship your package based on how much it weighs and how far you are sending the package. Packages above 100 ...” in 📘 Engineering if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers