Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- //global variables
- double totalDistance;
- double variableCosts;
- double shippingCost;
- double finalShippingCost;
- double n1, n2, n3, n4, n5, n6, n7, n8;
- int main()
- {
- void validDistance();
- void calcVariableCosts();
- const char poundSign(156);
- cout << "Enter the distance in miles:";
- cin >> totalDistance;
- validDistance();
- calcVariableCosts();
- shippingCost + 50 == finalShippingCost;
- cout.setf(ios::fixed);
- cout << setprecision(2);
- cout << "The cost of the shipment over " << totalDistance << "miles is " << poundSign << finalShippingCost << "\n";
- system("pause");
- return (0);
- }
- void validDistance()
- {
- if (totalDistance <= 0)
- {
- cout << "ERROR: The distance should be a positive value" << "\n";
- }
- else
- {
- (totalDistance > 0);
- }
- }
- void calcVariableCosts()
- {
- if (totalDistance <= 100)
- {
- totalDistance * 5.5 == shippingCost;
- }
- else if (totalDistance > 100 && totalDistance <= 500)
- {
- totalDistance - 100 == n1;
- 100 * 5.5 == n2;
- n1 * 4 == n3;
- n2 + n3 == shippingCost;
- }
- else if (totalDistance > 500)
- {
- totalDistance - 100 == n4;
- n4 - 400 == n5;
- 100 * 5.5 == n6;
- 400 * 4.0 == n7;
- n2 * 2.5 == n8;
- n6 + n7 + n8 == shippingCost;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement