The middle town company sells spools of copper wiring for 100.00 each and ships
ID: 3625475 • Letter: T
Question
The middle town company sells spools of copper wiring for 100.00 each and ships them for 10.00 apiece. write a program that displays the status of an order. it should use two functions. the first function asks for the following data and stores the input values in reference parameters. The # of spools ordered. The # of spools in stock.Any special s&h charges(above the regular 10.00 rate)The second function receives as arguments any values needed to compute and display the following info:The # of ordered spools ready to ship from current stock.The # of ordered spools on backorder(if the # ordered is greater than whats in stock).Total selling price of the portion ready to ship (the # of spools ready to ship * 100)Total s&h charges on portion readytoship and total of the order ready to ship. The s&h parameter in2nd function should have the default argument 10.00. dont accept accept less than1 for spools ordered, dont accept less than 0 for spools in stock or s&h chargesExplanation / Answer
//Header file section
#include<iostream>
using namespace std;
//function prototype
void getData(double &,double &,double &);
void display(double,double,double);
void main()
{
double noSpools,spoolsReady,charges;
//function call
getData(noSpools,spoolsReady,charges);
//function call to diplay
display(noSpools,spoolsReady,charges);
//pause system for a while
system("pause");
}//end main
//function definition
void getData(double &spools,double &ready,double &charges)
{
cout<<"Enter spools ordered:";
cin>>spools;
//validate input
if(spools<=1)
{
cout<<"Renter spools:";
cin>>spools;
}
cout<<"Number of spools ready:";
cin>>ready;
cout<<"Enter charges for spool:";
cin>>charges;
}//end getData
void display(double spools,double ready,double charges)
{
double total,subTotal;
cout<<"Number of spools ready to ship:"<<ready<<endl;
if(spools>ready)
cout<<"Number of spools backorder:"
<<spools-ready<<endl;
//calculating subtotal
subTotal=ready*100;
cout<<"Subtotal of portion ready to ship: $"
<<subTotal<<endl;
cout<<"Total shipping charges: $"
<<charges*ready<<endl;
cout<<"Total:"<<subTotal+(charges*ready)<<endl;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.