Heres the homework problem:
Write a program that displays the status of an order. The program should have a function that asks for the following data:
1. The number of spools ordered
2. The number of spools in stock
3. If there are special shipping and handling charges
(Shipping and handling is normally $10 per spool) If there are special charges, it should ask for special charges per spool.
The gathered data should be passed as arguments to another function that displays:
1. The number of spools ready to ship from current stock.
2. The number of spools on backorder (if the number ordered is greater than what is in stock)
3. Subtotal of the portion ready to ship (the number of spools ready to ship times $100)
4. Total shipping and handling charges on the portion ready to ship
5. Total of the order ready to ship
The shipping and handling parameter in the second function should have the default arguments 10.00.
Input validation:
1. Do not accept numbers less than 1 for spools ordered
2. Do not accept number less than 0 for spools in stock or shipping and handling charges.
===============================
I get an error "Void getInfo(void)" : overloaded function differs only by return type from "double getInfo(void)"
I have several return commands but I do not know how to write the code in sections for the first function. I think that maybe the issue. Here is what I got if anyone can lend a hand and Remember I am a BEGINNER so please explain any changes you make so I understand what is the purpose, etc.
Note: I have not learned arrays yet so please omit. Thanks!
#include <iostream>
#include <iomanip>
using namespace std;
void getInfo(double &, double &, double = 10.0);
void display(double backOrder, double spoolsOrdered, double subTotal, double shipping,
double total);
int main()
{
double getInfo(),
display();
void getInfo()
{
char s&h;
double spools,
stock,
charges;
cout << "Enter the amount of spools ordered: ";
cin >> spools;
while(spools < 1)
{
cout << "Enter a number greater than 0: ";
cin >> spools;
}
return spools;
cout << "Enter the amount of spools in stock: ";
cin >> stock;
while(stock < 0)
{
cout << "Enter a number greater than 0: ";
cin >> stock;
}
return stock;
cout << "Are there any special S&H Charges?: ";
cin >> s&h;
if(s&h == 'Y' || s&h == 'y')
{
cout << "Please enter in the amount of the special charges: ";
cin >> charges;
while(charges < 0)
{
cout << "Enter number greater than 0: ";
cin >> charges;
}
return charges;
}
void display(double spools, double stock, double charges)
{
double backOrder,
spoolsOrdered,
subTotal,
shipping,
total;
backOrder = spools - stock;
cout << "The amount of spools on back order is: " << backOrder << ".\n";
spoolsOrdered = spools - backOrder;
cout << "Spools ready to ship now: " << spoolsOrdered << ".\n";
subTotal = spoolsOrdered * 100;
cout << "Your subtotal before Shipping & Handling fees are $"
<< subTotal << endl;
shipping = subTotal + charges;
cout << "Your cost of shipping the spools of copper is $"
<< shipping << endl;
total = shipping + subTotal;
cout << "Your total cost of order is: $" << total << ".\n";
}
}