Question

Can someone complete this program for me in c programming language? Thank you!

The Send-Ex Shipping Company charges the following rates: Weight of Package 2 lbs or less Over 2 lbs but no more than 6 lbs Over 6 lbs but no more than 10 lbs Over 10 lbs Rate per Pound $1.10 $2.20 $3.70 $4.10 Write a program that asks the user to enter the weight of a package and then displays the total shipping charge. Reserve Point Opportunity/ Create a function that will accept the weight as a parameter and calculate and return the shipping charge. However, all interaction with the user must be performed from main). Do NOT show me two different programs, either you do the function or you dont!
0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<stdio.h>
float getShippingCharge(int wt){
   if(wt<=2){
       return wt*1.10;
   }
   else if(wt>2 && wt<=6){
       return wt*2.20;
   }
   else if(wt>6 && wt<=10){
       return wt*3.70;
   }
   else{
       return wt*4.10;
   }
}
int main(){
   int wt;
   printf("Enter the weight of the package in lbs ");
   scanf("%d",&wt);
   printf("Shipping charge is : %f",getShippingCharge(wt));
}

Expected output;

Enter the weight of the package in lbs Shipping charge is 11.000eee

Add a comment
Know the answer?
Add Answer to:
Can someone complete this program for me in c programming language? Thank you! The Send-Ex Shipping...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • The Fast Freight Shipping Company charges the following rates: Weight of Package Rate per Pound 2...

    The Fast Freight Shipping Company charges the following rates: Weight of Package Rate per Pound 2 pounds or less $1.50 Over 2 pounds but not more than 6 pounds $3.00 Over 6 pounds but not more than 10 pounds $4.00 Over 10 pounds $4.75 Write a program that asks the user to enter the weight of a package then displays the shipping charges.

  • In this assignment, you will develop a C++ program which calculates a shipping charge and determines...

    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...

  • Python Language 3. Shipping Charges The Fast Freight Shipping Company charges the following rates (per 500...

    Python Language 3. Shipping Charges The Fast Freight Shipping Company charges the following rates (per 500 miles shipped): 1. Number Guessing Game Write a program for players to guess the number that the program randomly generated. Your program should randomly generate an integer between 1 and 10. After a player guessing a number, your program should display "Too small", "Too large", or "That's it!". Weight of Package (in Kilograms) 2 kg or less Over 2 kg but not more than...

  • In C using (printf and scanf) Write a program to ask the user for the weight...

    In C using (printf and scanf) Write a program to ask the user for the weight of a package, and display the shipping charges for the package. If the weight of the package is less than or equal to 0 pounds, inform the user and exit the program. The shipping charges are: Weight of Package Shipping Charge 2 pounds or less $1.25 Over 2 pounds but not more than 6 pounds $2.50 Over 6 pounds but not more than 10...

  • My program works fine with if else conditions but when it is not working when I...

    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...

  • C PROGRAMMING Introduction In this part, you will solve a problem described in English. Although you...

    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...

  • C++ Lone Star Package Service ships packages within the state of Texas. Packages are accepted for...

    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...

  • Directions: Complete all the three programming assignments below. Please be sure to follow the programming rubric...

    Directions: Complete all the three programming assignments below. Please be sure to follow the programming rubric provided. Turn in three separate “.py" files. Be sure to run your programs before submission. Color Mixer The colors red, blue, and yellow are called primary colors, because they cannot be made by mixing other colors. When you mix two primary colors, you get a secondary color, as shown here: • When you mix red and blue, you get purple. • When you mix...

  • In this program, you will be using C++ programming constructs, such as overloaded functions. Write a...

    In this program, you will be using C++ programming constructs, such as overloaded functions. Write a program that requests 3 integers from the user and displays the largest one entered. Your program will then request 3 characters from the user and display the largest character entered. If the user enters a non-alphabetic character, your program will display an error message. You must fill in the body of main() to prompt the user for input, and call the overloaded function showBiggest()...

  • programming language c++ programming language c++ 1:25 #WW # 53% You may, if you wish, work...

    programming language c++ programming language c++ 1:25 #WW # 53% You may, if you wish, work in pairs; this means that a submission may have 2 names attached but those 2 people must have worked on the project. No free rides! The way to submit the program to me is as follows: put the entire program (main and any other functions) into a single compile. Compile it to be sure that you have the correct set of #include statements and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT