Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ program to perform the following general steps: Step 1: Ask the user to ente

ID: 3670516 • Letter: C

Question

C++ program to perform the following general steps:

Step 1:

Ask the user to enter the dimensions of the crate

Step 2:

Calculate:

the crate’s volume

the cost of building the crate

the customer’s charge

the profit made

Step 3:

Display the data calculated in Step 2.

Ask the user to input the crate's length.

Ask the user to input the crate's width.

Ask the user to input the crate's height.

Calculate the crate's volume.

Calculate the cost of building the crate.

Calculate the customer's charge for the crate.

Calculate the profit made from the crate.

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.

Explanation / Answer

#include <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: 6                                                                                                                            
Enter crate's width in meter: 10                                                                                                                            
Enter crate's height in meter: 20                                                                                                                           
                                                                                                                                                            
The cost of making a 1.2e+03 cubic meter crate is $2.8e+02                                                                                                  
By charging the customer $6.0e+02, you can make a profit of $3.2e+02                                                                                        
                                                                                                                                                            
Press Enter key to continue...                                                                                                                              
                                                                                                                                                            

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote