Post: [HELP] Shipping calculator homework
02-11-2014, 05:20 AM #1
Rawr
Can’t trickshot me!
(adsbygoogle = window.adsbygoogle || []).push({}); You must login or register to view this content.

Can someone explain to me how to do it? You don't have to do the assignment for me, just help me.

This is as far as I get before I go full retard. I don't know how to incorporate the miles into the shippingCharge.

    
#include <stdio.h>

main(){
double weight, miles, shippingCharge;

printf("Enter the weight of your package: ");
scanf_s("%lf", &weight);

printf("Enter how many miles the package will be traveling: ");
scanf_s("%lf", &miles);

if (weight <= 2){
shippingCharge = 1.50;
printf("Your shipping charge is: %.2lf", shippingCharge);
}
else {
if (weight < 6){
shippingCharge = 3.70;
printf("Your shipping charge is: %.2lf", shippingCharge);
}
else {
if (weight < 10){
shippingCharge = 5.25;
printf("Your shipping charge is: %.2lf", shippingCharge);
}
else {
if (weight >= 10){
printf("Sorry, we will not ship your package.");
}
}
}
}

system("pause");
}
02-14-2014, 03:47 AM #2
Bichote
Former Staff
Closed on request Smile

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo