00 miles, we'll ship that as well but we will charge for a full 500 miles. But if the distance is less than zero, set the distance to zero (which is really 500) and charge the user accordingly. This means that we will in fact ship your package less than ten miles (which differs from what the textbook says) but we will charge you quite a bit for that. We charge by the mile, so accept distances that are not multiples of 500 (e.g. 650 miles) and compute the fee accordingly (more than the cost for 500 miles, but le

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
icon
Concept explainers
Question

C++

Accept a package weight of zero; we'll ship it! If the user enters a weight that is less than zero, set it at zero instead. Do not display an error.

If the distance is less than 500 miles, we'll ship that as well but we will charge for a full 500 miles. But if the distance is less than zero, set the distance to zero (which is really 500) and charge the user accordingly. This means that we will in fact ship your package less than ten miles (which differs from what the textbook says) but we will charge you quite a bit for that.

We charge by the mile, so accept distances that are not multiples of 500 (e.g. 650 miles) and compute the fee accordingly (more than the cost for 500 miles, but less than for 1000). Fractions of miles are allowed so bring that input in as a double.

For your screen shot, enter a package weight of 12.5 kg to be shipped 1310.5 miles. As always for money, the shipping charge should show exactly two digits after the decimal point. For parameters that are out of bounds (too far or too heavy) display an error message.

The Fast Freight Shipping Company charges the following rates:
Rate per 500 Miles Shipped
Weight of Package (in Kilograms)
2 kg or less
$1.10
$2.20
Over 2 kg but not more than 6 kg
Over 6 kg but not more than 10 kg
$3.70
Over 10 kg but not more than 20 kg
$4.80
Write a program that asks for the weight of the package and the distance it is to be
shipped, then displays the charges.
Transcribed Image Text:The Fast Freight Shipping Company charges the following rates: Rate per 500 Miles Shipped Weight of Package (in Kilograms) 2 kg or less $1.10 $2.20 Over 2 kg but not more than 6 kg Over 6 kg but not more than 10 kg $3.70 Over 10 kg but not more than 20 kg $4.80 Write a program that asks for the weight of the package and the distance it is to be shipped, then displays the charges.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
Control Structure
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
  • SEE MORE 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