2. Program design First, write the general steps that this program might carry o
ID: 2267379 • Letter: 2
Question
2. Program design First, write the general steps that this program might carry out, such as the following one: 1. Ask customer to enter his/her name 2. Ask customer to input the crate's length, width and height (in feet) 3. Calculate the crate's volume. 4. Calculate the cost of building the wooden crate. 5. Calculate the customer's charge for the wooden crate. 6. Calculate the cost of mulch to fill the wooden carte. 7. Calculate the profit made from the crate 8. Display the crate's volume. Display the cost of building the crate. Display the customer's charge for the crate. Display the profit made from the crate, etc. The following formulas might be used to calculate the crate's volume, cost, charge, and profit, ete (Note: they are NOT valid C+ expenssion): crate volume length width height crate cost volume 0.27 crate price -volume 0.55 total customer price crate price+ mulch price 1cubic yard 27 cubic feets, etc. . Besides above, you need to pick a proper data type and name for each of the variables or constants the program might declare or need. Check the sample run of the program at the end of the specification for possible input and output format. Note: the exact spacing is not important, what is important is: the output looks good and the decimals and columns align. . Make sure you pick and use identifiers' names which are self-descriptive. . Also as we stated before, for cach assignment, put the following comment header on top of the file:Explanation / Answer
program
clude <iostream>
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
double length, width, height; // crate specificitons, user input values double volume, cost, charge, profit; // calculated values cout
<< "Enter crate's length in meter: ";
cin >> length;
cout << "Enter crate's width in meter: ";
cin >> width;
cout << "Enter crate's height in meter: ";
cin >> height; volume = length width height;
cost = volume * 0.23;
charge = volume * 0.5;
profit = charge - cost;
cout << setprecision(2) << showpoint
<< " The cost of making a " << volume << " cubic meter crate is $" << cost << ' '
<< "By charging the customer $" << charge << ", you can make a profit of $" << profit << endl;
cin.ignore(100, ' '); // flush cin buffer until end of line
cout << " Press Enter key to continue..." << endl; // For pausing the output
cin.get(); return 0;
}
output
Enter crate's length in meter: 8
Enter crate's width in meter: 12
Enter crate's height in meter: 15
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.