Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

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 packages 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 the shipping charges.

Freight Shipping Company Rates

______________________________________________________________

Weight of Package (pounds) Rate per 500 miles shipped

_______________________________________________________________

10 pounds or less $1.10

Over 10 pounds but not more than 20 $2.30

Over 20 pounds but not more than 35 $3.60

Over 35 pounds but not more than 50 $4.90

_______________________________________________________________

NOTICE: We do not ship packages over 50 pounds

We do not ship less than 10 miles or more than 15,000 miles

Requirements for your program:

The output must be labeled and easy to read.

Validate that the distance cant be less than 10 miles and more than 15,000 miles.

Use a logical operator when validating the distance to be shipped.

Display a menu of rate choices (similar to the chart above) so the user can choose the appropriate rate based on the package weight. Have the user enter a choice from the menu and use a switch statement to select and assign the rate.

Calculate the number of segments (a segment is 500 miles). Round uneven segments, i.e., segments not evenly divisible by 500, up to the next whole number (hint: use modulus or ceil).

There is a long haul charge of 50 cents per segment if the trip is over 20 segments.

The shipping charge is the number of segments times the shipping rate plus any long haul charge.

Use if-else and/or else-if and/or switch statements to determine the type of trip based on the segments and this table:

1 to 10 segments: type of trip is a short haul

11 to 20 segments: type of trip is a medium haul

21 to 30 segments: type of trip is a long haul

Provide two screen prints:

1) the user enters 12,300 miles distance and selects a rate for shipping a 35 pound package.

2) The user enters 1,050 miles distance and selects a rate for shipping a 10 pound package.

Display:

-the distance entered

-the selected rate

-the number of segments

-the packages shipping charge

-the type of trip

Submit:

Your .cpp file

Screen shot (s) of your output

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxiv Special Issue On Database And Expert Systems Applications Lncs 9510

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Hendrik Decker ,Lenka Lhotska ,Sebastian Link

1st Edition

366249213X, 978-3662492130

More Books

Students also viewed these Databases questions

Question

explain why excessive protocol errors can be bad for a network.

Answered: 1 week ago