ITIS 1214 Assignment 1 Part 2

ITIS 1214 Assignment 1 Part 2 - { cost = (weight - 5) * .25...

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

View Full Document Right Arrow Icon
/* 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
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
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 &gt;= 10 &amp;&amp; weight &lt; 15) { cost = (weight - 10) * .20 + 5.50; } else { if (weight &gt;= 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 &lt;&lt; &quot;Error in input&quot; &lt;&lt; endl; } cout &lt;&lt; &quot;The weight of your package is &quot; &lt;&lt; weight &lt;&lt; endl; cout &lt;&lt; &quot;The region you chose is region &quot; &lt;&lt; region &lt;&lt; endl; cout &lt;&lt; &quot;The price to ship your package is $&quot; &lt;&lt; cost; }...
View Full Document

Page1 / 2

ITIS 1214 Assignment 1 Part 2 - { cost = (weight - 5) * .25...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online