Question

write a program for C++ to use on Putty . C++ not Java The Fast Freight...

write a program for C++ to use on Putty . C++ not Java

The Fast Freight Company provides three kinds of shipping services for packages: regular, priority and overnight. They charge the following rates:

Regular

Priority

Overnight

<= 2 Kg

$1.00 per Kg

$3.50 per Kg

$11.50 per Kg

> 2 Kg but <=6 Kg

$1.50 per Kg

$5.50 per Kg

$16.50 per Kg

> 6 Kg but <=10 Kg

$2.00 per Kg

$7.50 per Kg

$21.50 per Kg

> 10 Kg

$2.50 per Kg

$9.50 per Kg

$26.50 per Kg

Write a program that will accept as input a one-character service code (‘R’ for Regular, ‘P’ for Priority, ‘O’ for Overnight) followed by the weight of the package. The program should then compute and print the appropriate charge for the customer.

For example, your program should output something like the following

     >./a.out

     Please enter the service code and weight of the package: P 8.0

   

The service you chose is Priority service.

     The weight of your package is 8.0 Kilograms.

     The shipping charge for this package is $60.

Note:

The program MUST contain at least one if statement and at least one switch statement.

For service codes other than R, P and O, your program should output an error message “Error: Invalid service code” and quit.

The weight of the package may be a decimal number.

Test your program with the following inputs

R1.5shipping charge should be $1.5

R2.5shipping charge should be $3.75

P8.0shipping charge should be $60

O12.0shipping charge should be $318

S 3.4    Your program should display an error message and terminate

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
write a program for C++ to use on Putty . C++ not Java The Fast Freight...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • C++ IMPORTANT: Write a driver program (PackageDriver) that creates objects of each type of Package as...

    C++ IMPORTANT: Write a driver program (PackageDriver) that creates objects of each type of Package as pointers to a Package and cout the objects. Write a driver program (PackageDriver) that creates objects of each type of Package as pointers to a Package and cout the objects. Write a driver program (PackageDriver) that creates objects of each type of Package as pointers to a Package and cout the objects. Package-delivery services, such as FedEx®, DHL® and UPS®, offer a number of...

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

  • Write a program that will accept two integers on command line, use the swap subprogram to...

    Write a program that will accept two integers on command line, use the swap subprogram to swap them, and then print the two numbers out. For example, I enter a.out 10 15 and the output that would print is 15 10. Please note that if exactly two numbers are not provided on command line, your program should display an error message and end with no further action. The programming language is C Compiler.

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

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

  • Intro to C++ For this program, again use Program 4-18 in the text as an example....

    Intro to C++ For this program, again use Program 4-18 in the text as an example. Assume you're writing this menu-driven program for a shipping company. There are two types of shipments: normal and expedited. a. As shown in Program 4-18, please declare constants for the types of shipments. Please write the names of constants in ALL CAPS. b. Show the menu in a clear form, and prompt the user for the type of shipment; the rest of the program...

  • Write a C++ program that will calculate the total amount of money for book sales at...

    Write a C++ program that will calculate the total amount of money for book sales at an online store. For each sale, your program should ask the number of books sold and then the price for each book and the shipping method (‘S’ for standard shipping and ‘E’ for expedited shipping). The program will produce a bill showing the subtotal, the sales tax, the discount, the shipping charge, and the final total for the sale. The program will continue processing...

  • Objective: Use input/output files, strings, and command line arguments. Write a program that processes a text...

    Objective: Use input/output files, strings, and command line arguments. Write a program that processes a text file by removing all blank lines (including lines that only contain white spaces), all spaces/tabs before the beginning of the line, and all spaces/tabs at the end of the line. The file must be saved under a different name with all the lines numbered and a single blank line added at the end of the file. For example, if the input file is given...

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

  • C++ Program Your program should: 1) Validate that the number of commandline arguments, after a.out is...

    C++ Program Your program should: 1) Validate that the number of commandline arguments, after a.out is in the range [1,6]. If not, print an error message and stop the program with exit code 1. 2) Declare a vector of ints or array of ints to store the arguments. Use a loop to parse all the arguments (except a.out) into your vector/array. 3) Use a loop to calculate the greatest number (maximum). If the maximum is greater than 100, print "XNN"...

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