C programming only
(Original work only as well, I will get into trouble if it is a copy)
also please add comments if it is not too much trouble.
Program 5: Shipping Calculator
The Speedy Shipping Company will ship packages based on how much they weigh and how far they are being sent. They will only ship small packages up to 10 pounds. You have been tasked with writing a program that will help Speedy Shipping determine how much to charge per delivery.
The charges are based on each 500 miles shipped. Shipping charges are not pro-rated; i.e., 600 miles is the same charge as 900 miles; i.e., 600 miles is counted as 2 segments of 500 miles.
Here is the table they gave you:
Package Weight Rate per 500 miles shipped
2 pounds or less $1.50
More than 2 but not more than 6 $3.70
More than 6 but not more than 10 $5.25
Test Case 1:
Input Data:
Weight: 1.5 pounds
Miles: 200 miles (This is one 500-mile segment.)
Expected result:
To ship a 1.5 pound package 200 miles, your shipping charge is $1.50.
Test Case 2:
Input Data:
Weight: 5.6 pounds
Miles: 1200 miles (This is three 500-mile segments.)
Expected result:
To ship a 5.6 pound package 1200 miles, your shipping charge is $11.10.
Test Case 3:
Weight: 1.0 pounds
Miles: 2000 miles (This is four 500-mile segments.)
Expected result:
To ship a 1.0 pound package 2000 miles, your shipping charge is $6.00.
Test Case 4:
Weight: 8.5 pounds
Miles: 12345 miles (This is twenty-five 500-mile segments.)
Expected result:
To ship a 8.5 pound package 12345 miles, your shipping charge is $131.25.
Test Case 5:
Weight: 12.8 pounds
Miles: 345 miles
Expected result:
Sorry, we only ship packages of 10 pounds or less.
Hints: This program does not need any loops. The program will calculate one shipping charge and stop. Your test cases should test the various possibilities, and the limits of the program.
BIG Helpful Hint: You can use integer division. For example: 1200 / 500 = 2
C Code:
#include<stdio.h>
int main() {
float weight = 0, rate =0, total = 0;
int miles =0, ship =0;
//Getting the inputs from user
printf("Enter weight of package: ");
scanf("%f", &weight);
printf("Enter shipping distance: ");
scanf("%d", &miles);
//Calculating the rate as per weight
if(weight >=0 && weight<=10){
if(weight <=2){
rate = 1.5;
}
else if(weight >2 && weight<=6){
rate = 3.7;
}
else{
rate = 5.25;
}
ship = (miles/500) +1;
total = rate * ship;
//printing out the result
printf("To ship a %.1f pound package %d miles, your shipping charge
is $%.2f.",weight, miles, total);
}
else{
printf("Sorry, we only ship packages of 10 pounds or less");
}
}
Outputs:



C programming only (Original work only as well, I will get into trouble if it is...
Global Courier Services will ship your package based on how much it weighs and how far you are sending the package. Packages above 50 pounds will not be shipped. You need to write a program in C that calculates the shipping charge. The shipping rates are based on per 500 miles shipped. They are not pro-rated, i.e., 600 miles is the same rate as 900 miles or 1000 miles. Here are the shipping charges - Package Weight Rate...
PSLAYER 09/27/2017 yo October 9,2017 Graduation st Monday at T2:43 AM Shipping Calculator: Global Courier Services will ship your package based on how much it weighs and how far you are sending the package. Packages above 50 pounds will not be shipped. You need to write a program in C that calculates the shipping charge The shipping rates are based on per 500 miles shipped. They are not pro-rated, ie, 600 miles is the same rate as 900 miles or...
C PROGRAMMING Introduction In this part, you will solve a problem described in English. Although you may discuss ideas with your classmates, etc., everyone must write and submit their own version of the program. Do NOT use anyone else’s code, as this will result in a zero for you and the other person! Shipping Calculator Speedy Shipping Company will ship your package based on the weight and how far you are sending the package, which can be anywhere in the...
IN C++ PROGRAMMING (We use #include <iostream> and cout and cin) Shipping Calculator Speedy Shipping Company will ship your package based on the weight and how far you are sending the package, which can be anywhere in the world. They will only ship small packages up to 10 pounds. You need to have a program, which will help you determine how much they will charge. The charges are based on each 500 miles shipped. The mileage should be in whole...
In this assignment, you will develop a C++ program which calculates a shipping charge and determines the “type of trip” for a freight shipping company. Ask the user to enter the distance a package is to be shipped, and use a menu and a switch statement to determine the rate based on the package’s weight. Then display the shipping charge and using the table in #7 below, display the type of trip. Below is the chart to use to calculate...
Global Courier Services will ship your package based on how much it weighs and how far you are sending the package. (visual studio or dev c) You need to write a design tool and a program in C that calculates the shipping charge based on weight and distance and the total cost. The shipping rates are as follows: BASED ON WEIGHT Charge 10 dollars for all package weighing 10 pounds or less Charge an additional 2 dollars per pound for...
Global Courier Services will ship your package based on how much it weighs and how far you are sending the package. You need to write a design tool and a program in C that calculates the shipping charge based on weight and distance and the total cost. The shipping rates are as follows: BASED ON WEIGHT Charge 10 dollars for all package weighing 10 pounds or less Charge an additional 2 dollars per pound for each pound above 10 (make...
In C++ Assignment 7 - Postal Packages In the Gaddis textbook read Chapter 8 sections 8.1-8.10 and Chapter 9 section 9.1 before starting this assignment. Lone Star Package Service ships packages within the state of Texas. Packages are accepted for shipping subject to the following restrictions: Shipping requirements The package weight must not exceed 50 pounds. The package must not exceed 3 feet in length, width, or height. The girth of the package must not exceed 5 feet. The girth...
C++ Lone Star Package Service ships packages within the state of Texas. Packages are accepted for shipping subject to the following restrictions: Shipping requirements The package weight must not exceed 50 pounds. The package must not exceed 3 feet in length, width, or height. The girth of the package must not exceed 5 feet. The girth is the circumference around the two smallest sides of the package. If side1, side2, and side3 are the lengths of the three sides, and...
My program works fine with if else conditions but when it is not working when I try to implement it using a for loop. Can you fix my for loop and please show me how to do this using loops? I would appreciate if you could explain the loop that you are using. /* Programming Challenge: Shipping Charges The Fast Freight Shipping Company charges the following rates: Weight of Package (in Kilograms) Rate per 500 Miles Shipped 2 kg or...