Write C++ program that will calculate the shipping information for a wholesale kitchen appliance company. program should be done using functions. Information needs be done with parameters. Global variables are banned. The coded program will ask the user for the number of appliances ordered by the company. the given code will have to display the number of appliances to be sent, the subtotal of the cost for the appliances being sent, the shipping charges for the appliances being sent and the total cost for the appliances being sent. the handling and shipping charges are 10% of the subtotal of the costs. You should write a user-defined function to perform each of the following tasks: show the instructions o takes no parameters o returns no value read from the user the number of appliances ordered o takes no parameters o returns the number of appliances orders calculate and return the subtotal for the ordered and shipped appliances ($500 per appliances) o takes one parameter (number of appliances ordered) o returns the subtotal of the orders of appliances calculate and return the shipping and handling for the ordered and shipped appliances o takes one parameter (subtotal) o returns shipping and handling charges calculate and return the total cost for the shipped and ordered appliances o takes two parameters (one for subtotal, one for shipping & handling charge) o returns total cost print the results in a neat and well labeled form o takes four parameters (number ordered, subtotal, shipping, total cost) o print values in the correct format o returns no value
This is the end of the question. I am honestly super confused. Any help would be nice.
This question Purely wants to check if you are able to solve even a simple program using function or not..
suppose we have a program to just take a input from user and print it to the display, we can write the same program using function and without funtions.
// without function.
#include<iostream>
using namespace std;
int main()
{
int a;
cin>>a;
cout<<a;
return 0;
}
// same program with multiple functions..
#include<iostream>
using namespace std;
int TakeInput()
{
int temporary;
cin>>temporary;
return temporary;
}
void Display(int a)
{
cout<<a<<endl;
}
int main()
{
int a =TakeInput();
Display(a);
return 0;
}
// WholeSale_KitChen.cpp
//
#include <iostream>
using namespace std;
// this function simply takes takes order in form of number of
appliances and returns the same to the caller.
int TakeOrders(void)
{
int num_of_appliances;
cin >> num_of_appliances;
return num_of_appliances;
}
// This function is used to calculate the subtotal of the number of
the appliances ordered and returns the
// subtotal.
int CalculateSubTotal(int No_of_appliances_Ordered)
{
int subtotal;
// Since rate is $500 per appliances.
subtotal = 500 * No_of_appliances_Ordered;
return subtotal;
}
// This function Calculates the Total cost which is summation of
subtotal and shipping and handling charges
// which is passed as parameter to the function and returns the
total cost.
float CalculateTotalCost(int subtotal, float
shipping_handlingCharge)
{
float totalcost = subtotal + shipping_handlingCharge;
return totalcost;
}
// This function is used to calculate Shipping and Handling
Charges which is 10% of the subtotal which is passed as
// a paramter to the function.
float CalculateShippingHandling(int subtotal)
{
// since shipping and handling charge is 10% of the
subtotal..
float shipping_handlingCharge = 0.1 * subtotal;
return shipping_handlingCharge;
}
// This function has a job to take four paramters as written and print the details In Neat Form.
void printNeatForm(int No_of_Appliances_Ordered, int subtotal,
float shipping_handlingCharge, float total_cost)
{
cout << " The Number of Appliances Ordered By the Company is
:" << No_of_Appliances_Ordered << endl;
cout << " The subtotal cost of All appliances as per $500 per
Appliance is : " << subtotal << endl;
cout << " The Shipping and Handling Charge is 10% of the
Subtotal which is :"<<shipping_handlingCharge<<
endl;
cout << " The total cost for the Shipped Appliances is :"
<< total_cost << endl;
}
// This function is used only to show instruction to the End
User.
// it does not takes any parameter and does not return any
value..
void ShowInstructions(void)
{
cout << "Enter the Number of Appliances Ordered By the
Company :";
int No_of_Appliances_Ordered =TakeOrders();
int subtotal = CalculateSubTotal(No_of_Appliances_Ordered);
float shipping_handlingCharge =
CalculateShippingHandling(subtotal);
float total_cost = CalculateTotalCost(subtotal,
shipping_handlingCharge);
printNeatForm(No_of_Appliances_Ordered, subtotal, shipping_handlingCharge, total_cost);
}
int main()
{
ShowInstructions();
return 0;
}
Get Answers For Free
Most questions answered within 1 hours.