{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ITIS 1214 Assignment 1 Part 2

# ITIS 1214 Assignment 1 Part 2 - cost =(weight 5.25 3 else...

This preview shows pages 1–2. Sign up to view the full content.

/* Program: CostPackage Author: Cory Carman Date: 10/3/07 Purpose: This program will have the user input the weight of a package and calculate the cost of mailing that package. It will print the weight of the package and its cost to send. The program will then ask the user what region they are sending the package to add a fee accordingly */ #include <iostream> using namespace std; int main() { float weight; float cost; char region; cout << "Please input the weight of the package you wish to send: " ; cin >> weight; cout << "Enter if you are sending your package to region A, B, C, or D: " ; cin >> region; if (weight < 5) { cost = 3; } else { if (weight >= 5 && weight < 10)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { cost = (weight - 5) * .25 + 3; } else { if (weight >= 10 && weight < 15) { cost = (weight - 10) * .20 + 5.50; } else { if (weight >= 15) { cost = (weight - 15) * .10 + 8.50; } } } } switch (region) { case 'a' : case 'A' : cost += 1; break ; case 'b' : case 'B' : cost += 1.5; break ; case 'c' : case 'C' : cost += 2; break ; case 'd' : case 'D' : cost += 2.5; break ; default : cout << "Error in input" << endl; } cout << "The weight of your package is " << weight << endl; cout << "The region you chose is region " << region << endl; cout << "The price to ship your package is \$" << cost; }...
View Full Document

{[ snackBarMessage ]}

### Page1 / 2

ITIS 1214 Assignment 1 Part 2 - cost =(weight 5.25 3 else...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online