Question

Write C++ program that will calculate the shipping information for a wholesale kitchen appliance company. program...

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.

Homework Answers

Answer #1

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;
  
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
c++ Write a program that calls a function calculateSum to calculate the sum from -1 to...
c++ Write a program that calls a function calculateSum to calculate the sum from -1 to N. The function calculateSum has one parameter N of type integer and returns an integer which represents the sum from -1 to N, inclusive. Write another function calculateAverage that calculates an average. This function will have two parameters: the sum and the number of items. It returns the average (of type float). The main function should be responsible for all inputs and outputs. Your...
Part 3. Write a function called totalCost that takes three parameters (shipping cost, cost of one...
Part 3. Write a function called totalCost that takes three parameters (shipping cost, cost of one box, and number of boxes purchased) and returns the total cost which is computed using the following formula: shipping cost + (number of boxes purchased) * (cost of one box). Default values for the parameters are the following: shipping cost is 0, cost of one box is $4, number of boxes is 1. In the main function test your totalCost function with no arguments,...
Write some C++ program segments that solves the indicated tasks (you do not have to write...
Write some C++ program segments that solves the indicated tasks (you do not have to write a complete program, nor be concerned about "good" output; a small code segment will be enough). a) A program that gets a double number from the user, decides whether that number is positive, negative, or zero and display its decision on the screen. a) A function isPositive that takes as input a double number and returns the integer 1 if the number is positive,...
Program Instructions Write a program called censor.py. This program will have the following functionality and requirements:...
Program Instructions Write a program called censor.py. This program will have the following functionality and requirements: Has a main function: That asks the user to input a sentence Then asks the user to enter a list of words they want to replace (separated by spaces) Calls a function called replaceMultiWords passing those two parameters, which returns a filtered string Prints out the filtered (censored) string to the console Has a replaceMultiWords function that: Takes a string "sentence" and a string...
write a c++ program A class called car (as shown in the class diagram) contains: o...
write a c++ program A class called car (as shown in the class diagram) contains: o Four private variables: carId (int), carType (String), carSpeed (int) and numOfCars (int). numOfCars is a static counter that should be  Incremented whenever a new Car object is created.  Decremented whenever a Car object is destructed. o Two constructors (parametrized and copy constructor) and one destructor. o Getters and setters for the Car type, ID, and speed. And static getter function for numOfCars....
Write a C program that prompts the user to enter a line of text on the...
Write a C program that prompts the user to enter a line of text on the keyboard then echoes the entire line. The program should continue echoing each line until the user responds to the prompt by not entering any text and hitting the return key. Your program should have two functions, writeStr and readLn, in addition to the main function. The text string itself should be stored in a char array in main. Both functions should operate on NUL-terminated...
Write a C++ program that processes orders for our company Widgets and More. Your program will...
Write a C++ program that processes orders for our company Widgets and More. Your program will read the product code and quantity for all the products in an order from a file, order.txt. You will be given a sample order.txt with the starter code. There are two items on each line of the file the first is a letter that represents the product and the second is an integer representing the number bought. Based on the product and quantity, you...
Write the Game class, Java lanuage. A Game instance is described by three instance variables: gameName...
Write the Game class, Java lanuage. A Game instance is described by three instance variables: gameName (a String), numSold (an integer that represents the number of that type of game sold), and priceEach (a double that is the price of each of that type of Game). I only want three instance variables!! The class should have the following methods: A constructor that has two parameter – a String containing the name of the Game and a double containing its price....
Has to be written in C#! Write a program that includes an Employee class that can...
Has to be written in C#! Write a program that includes an Employee class that can be used to calculate and print the take-home pay for a commissioned sales employee. Items to include as data members are employee number, first name, last name, and total sales. All employees receive 9% of the total sales of the month. Federal tax rate is 18%. Retirement contribution is 10%. Social Security tax rate is 6%. Use appropriate constants, design an object-oriented solution, and...
In this assignment you will write a program that compares the relative strengths of two earthquakes,...
In this assignment you will write a program that compares the relative strengths of two earthquakes, given their magnitudes using the moment magnitude scale. Earthquakes The amount of energy released during an earthquake -- corresponding to the amount of shaking -- is measured using the "moment magnitude scale". We can compare the relative strength of two earthquakes given the magnitudes m1 and m2 using this formula: f=10^1.5(m1−m2) If m1>m2, the resulting value f tells us how many times stronger m1...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT