XXXXXXXXXXFile Types XXXXXXXXXXdoc and docx Assignment 4 Shipping Calculator Goal: You will apply everything you have learned so far about variables, data types, operators, and selection to write a...

1 answer below »



  • File Types doc and docx



Assignment 4



Shipping Calculator


Goal: You will apply everything you have learned so far about variables, data types, operators, and selection to write a simple but nonetheless real-world application.


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 per 500 miles shipped



  • Less than or equal to 10 pounds $3.00

  • More than 10 pounds but less than or equal to 50 pounds $5.00


If the shipping distance is more than 1000 miles, there is an additional charge of $10 per package shipped.


Here are some test cases.



Test Case 1:



Input Data:


Weight: 1.5 pounds


Miles: 200 miles (This is one 500 mile segment.)



Expected results:


Your shipping charge is $3.00



Test Case 2:



Input Data:


Weight: 5.6 pounds


Miles: 1200 miles (This is three 500 mile segments.)



Expected results:


Your shipping charge is $19.00



Test Case 3:



Input Data:


Weight: 11.0 pounds


Miles: 2000 miles (This is four 500 mile segments.)



Expected results:


Your shipping charge is $30.00



Test Case 4:



Input Data:


Weight: 38 pounds


Miles: 9600 miles (This is twenty 500 mile segments.)



Expected results:


Your shipping charge is $110.00



Test Case 5:


Weight: 55 pounds


Miles: 345 miles



Expected results:


Sorry, we only ship packages of 50 pounds or less.




You need to



  • Create an IPO.
    (10 points)

  • Create one more non-trivial (all zeros) test case.
    (4 points)

  • Write and debug the code that solves the problem.
    (65 points)


  • Take screen shots of running the program six different times. Use the five test cases given above and one more test case that you have created. (Total six test cases -12 points)

  • Include programmer name, date and brief problem description at the beginning of the code.
    (4 points)

  • Include meaningful comments wherever necessary.
    (5 points)



Hints: This program does not need any loops. We are only up to video segment 7. It will calculate one shipping charge and stop.



Deliverables: Submit only one Word document.



  1. Include your IPO at the top.

  2. Then, copy and paste your code into the Word document.

  3. State your additional test case.

  4. Then use ‘Snipping tool’ to take the screen shots of the 6 outputs. (Google it if you do not know how to use it.)

  5. Submit the Word document with solutions to all parts of the assignment by the deadline.

Answered Same DayFeb 21, 2021

Answer To: XXXXXXXXXXFile Types XXXXXXXXXXdoc and docx Assignment 4 Shipping Calculator Goal: You will apply...

Arun Shankar answered on Feb 23 2021
134 Votes
shipment charge calculator/IPO diagram.png
shipment charge calculator/output screenshots/screenshot
_01.JPG
shipment charge calculator/output screenshots/screenshot_02.JPG
shipment charge calculator/output screenshots/screenshot_03.JPG
shipment charge calculator/output screenshots/screenshot_04.JPG
shipment charge calculator/output screenshots/screenshot_05.JPG
shipment charge calculator/output screenshots/screenshot_06.JPG
shipment charge calculator/program.c
/*
Name:
Date: 23rd Feb, 2020
Problem description: The program accepts from the user the weight of the shipment in pounds, and the distance in miles. It then computes and displas the shipping cost.
*/
#include
#include...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here