This has to be in C++   You want to write a program that will generate accurate shipping charges for a local grocery store. The shipping charges for the store are as follows: Weight of Package (in pounds)                Rate per mile Shipped  5 Lbs or less                                                         $0.20 Over 5 Lbs but no more than 8 Lbs                       $0.35 Over 8 Lbs but not more than 16 Lbs                    $0.45 Over 16 Lbs                                                          $0.50 Do NOT use global variables for this exercise.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

This has to be in C++

 

  1. You want to write a program that will generate accurate shipping charges for a local grocery store. The shipping charges for the store are as follows:

    Weight of Package (in pounds)                Rate per mile Shipped 
    5 Lbs or less                                                         $0.20
    Over 5 Lbs but no more than 8 Lbs                       $0.35
    Over 8 Lbs but not more than 16 Lbs                    $0.45
    Over 16 Lbs                                                          $0.50

    Do NOT use global variables for this exercise.

    Write a function in a program that asks for the weight of a package in pounds and the distance it is to be shipped. These two arguments are to be passed into the funciton by REFERENCE.

    Using that data, write a second function (called by the main program) that calculates the shipping charge and returns it to the main program and displays the value inside the main program. For the second function, pass the two values (weight and distance) into the function as arguments. In the second function, if the shipping distance the user provided earlier is a distance greater than 20 miles, there will be an additional "Extended Distance" charge of $50 added to the order. For example, if an item weighing 21 pounds is shipped 25 miles, the total cost will be $62.50, calculated by the formula: ((25 miles * 0.50) + 50).

    Output to the user might read:

    A package weighing 21 pounds being shipped 25 miles will cost $62.50, which includes an "extended" distance charge of $50.

    input validation: Do not accept any weights less than 1 pound, nor any distances less than 0 miles.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education