Question: CSC135 Programming Assignment #2 Shipping Charges The Fast Freight Company provides three kinds of shipping services for packages: Regular, Priority and Overnight. They charge the

CSC135 Programming Assignment #2 Shipping Charges The Fast Freight Company provides three kinds of shipping services for packages: Regular, Priority and Overnight. They charge the following rates: 2 kg but 6 kg but 10 kg Regular $1.00 per kg $1.50 per kg $2.00 per kg $2.50 per kg Priority $3.50 per kg $5.50 per kg $7.50 per kg $9.50 per kg Overnight $11.50 per kg $16.50 per kg $21.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:P Please enter the weight of the package: 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.00 Important: 1. Name the program ifswitch.cpp (no caps!) 2. The program MUST contain at least one if statement and at least one switch statement. 3. For service codes other than R, P and O, your program should output an error message: "Error: Invalid service code" and quit. 4. The weight of the package may be a fractional number. 5. Test your program with the following input a. R 1.5 shipping charge should be $1.50 b. R 2.5 shipping charge should be $3.75 C. P 8.0 shipping charge should be $60.00 d. O 12.0 shipping charge should be $318.00
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
