You are on page 1of 2

#include <iostream>

using namespace std;


void math(int num1, int num2, double num3);
int main()
{
//(ORDER STATUS)
int Order,
Stock;
double Special;
char question;

cout <<"Middleton Wireless Company Ordering System\n"


<<"Place the amount for the number of spools ordered" << endl;
cin >> Order ;
if (Order < 1)
{
cout <<"Invalid Input! \n"
<<"Order must be larger than 0. \n"
<<"\n"
<<"Place the amount for the number of spools ordered" << en
dl;
cin >> Order ;
}
cout << "\n"
<<"How many spools are currently in stock?" << endl;
cin >> Stock;
if (Stock <= 0)
{
cout <<"Invalid Input! \n"
<<"There are more than 0 spools in stock. \n"
<<"Input the correct data.\n"
<< "\n"
<<"How many spools are currently in stock?" << endl;
cin >> Stock;
}
cout <<"\n"
<<"Any additonal shipping & handling charges? \n"
<<"If so enter (y/Y), If there are none enter (n/N)" << endl;
cin >> question;
if (question == 'n' || question == 'N')
{
Special = 0.00;
}
else if (question == 'y' || question == 'Y')
{
cout <<"Enter the amount for additional shipping and handling ch
arges \n"
<<"$";
cin >> Special;
}
math(Order, Stock, Special);
system("pause");
return 0;
}
void math(int num1, int num2, double num3)
{
int spools = num1,
stock = num2;
double special = num3;
double shipping = 10.00,
addshipping = shipping + num3,
readyorder = spools,
price = 100 * readyorder,
total = addshipping + price,
backorder = spools - stock;
//IF ORDER WAS TOO LARGE FOR SPOOLS IN STOCK
if (backorder > 0)
{
double readyorder = stock,
price = 100 * stock,
total = addshipping + price;
cout <<"\n"
<<"The order was too large for the current number of sp
ools in stock, \n"
<<"There is a backorder of " << backorder <<" spools. \
n"
<<"The available number of spools ready to ship is " <<
readyorder << endl;
system("pause");
}

cout <<"\n"
<<"The price of the current order is $" << price <<"\n"
<<"All shipping and handling charges come to $" << addshipping
<<"\n"
<<"The total cost for the order will be $" << total << endl;
}