I currently trying to work on this problem and am running into a problem on how to write it.
Weight of Package Rate per 500 Miles Shipped
2 => weight 1.10
2 < weight <= 6 2.20
6 < weight <=10 3.70
10 < weight <= 20 4.80
So if the user inputs package weight3 pounds, it would charge 1.10 rate * 2.
I am just having a hard time figuring out how I would write the if and if else statement that would factor the following.
1 2 3 4
cout << ("Please enter the weight of the package in pounds: ");
cin >>wPackage
cout << ("Please enter the distance the pack will be shipped in miles: ");
cin >> dShipped
then i followed up with
1 2 3
if (wPackage =>2)
cout<<("Your package weight is: ") wPageage;
cout<<("Your package rate is: ")
I am trying to figure out where i would put other if statements to calculate the distance. Would I do before it before do the "if" statement for package weight
#include <iostream>
usingnamespace std;
int main() // Most important part of the program!
{
int age; // Need a variable...
cout<<"Please input your age: "; // Asks for age
cin>> age; // The input is put in age
cin.ignore(); // Throw away enter
if ( age < 100 ) { // If the age is less than 100
cout<<"You are pretty young!\n"; // Just to show you it works...
}
elseif ( age == 100 ) { // I use else just to show an example
cout<<"You are old\n"; // Just to show you it works...
}
else {
cout<<"You are really old\n"; // Executed if no other statement is
}
cin.get();
}