Question: #include #include using namespace std; bool readFunction(int &spoolsOrdered, int &spoolsInStock, double &shipHandling) { bool invalid = 1; char specialShip; cout < < fixed < <

#include #include using namespace std;

bool readFunction(int &spoolsOrdered, int &spoolsInStock, double &shipHandling) { bool invalid = 1; char specialShip; cout << fixed << setprecision(2);

cout << "Spools to be ordered "; cin >> spoolsOrdered; if(spoolsOrdered <= 0) { cout << "Spools order must be 1 or more "; return invalid;

}

cout << "Spools in stock "; cin >> spoolsInStock; if(spoolsInStock < 0) { cout << "Spools in stock must be 0 or more "; return invalid; }

cout << "Special shipping and handling (y or n) "; cin >> specialShip;

if(specialShip == 'y') { cout << "Shipping and handling amount "; cin >> shipHandling; } else { shipHandling = 11.88; }

if(shipHandling < 0) { cout << "The spool shipping and handling charge must be 0.0 or more "; return invalid; } return 0; }

void displayFunc(int spoolsOrdered, int spoolsInStock, double shipHandling) { double readyShip, readyShipTotal, shippingCharge; int backOrder;

cout << "Spools ready to ship: " << spoolsInStock << endl; backOrder = spoolsOrdered - spoolsInStock; cout << "Spools on back-order: " << backOrder << endl; readyShipTotal = spoolsInStock*100; cout << "Subtotal ready to ship: " << "$" << setw(10) << fixed << setprecision(2) << readyShipTotal << endl; shipHandling*=spoolsInStock; cout << "Shipping and handling: " << " $" << setw(10) << fixed << setprecision(2) << shipHandling << endl;

shippingCharge = readyShipTotal + shipHandling; cout << "Total shipping charges: " << "$" << setw(10) << shippingCharge << endl;

}

int main() { int spoolsOrdered, spoolsInStock; double shipHandling;

bool valid = readFunction(spoolsOrdered,spoolsInStock, shipHandling); if(!valid)

displayFunc(spoolsOrdered, spoolsInStock, shipHandling);

return 0; }

****************************************

This is the input

10

11

y

0 999999.99

This is what should output:

Spools to be ordered

Spools in stock

Special shipping and handling (y or n)

Shipping and handling amount Spools ready to ship: 10

Spools on back-order: 0

Subtotal ready to ship: $ 1000.00

Shipping and handling: $ 0.00

Total shipping charges: $ 1000.00

Although it outputs something way differently

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!