2kgs or less -- rate per 500 miles shipped = $1.10
upto or 6kg -- rate per 500 miles shipped = $1.10
upto or 10kg-- rate per 500 miles shipped = $1.10
upto 20kg-- rate per 500 miles shipped = $1.10
input validations
distance < 10 and > 3000 miles
weight cannot be 0 and should be less than 20 kgs
ask user the distance and the weight of the package.
I am facing these problems
1) how do i round the amount to two decimals?
2) input validation does not work.
Posting my code below this please help me.
Thanks :)
while ( distance < 10 && distance > 3000)
{
cout << "please enter a distance less than 3000m and greater than 10 miles" << endl;
cout << "Enter distance: ";
cin >> distance;
}
// decide rate
if (weight <= 2)
cost = 1.10;
else if (weight < 6)
cost = 2.20;
else if (weight < 10)
cost = 3.70;
else cost = 4.80;