fork download
  1. //Castulo Jason Quintero CSC5 Chapter 2, P. 83, #13
  2. //
  3. /**************************************************************
  4.  *
  5.  * COMPUTE FINAL SALE PRICE TO GROSS 40% PROFIT
  6.  * ____________________________________________________________
  7.  * This program computes the final sale price of an item to set
  8.  * gross a profit margin of 40 percent.
  9.  *
  10.  * Computation is based on the formula:
  11.  * X = Production cost / 2;
  12.  * Final Sale Price = X * 5;
  13.  * ____________________________________________________________
  14.  * INPUT
  15.  * oemPrice: Original Production Cost
  16.  * oemPriceBy2: Original Production / by 2
  17.  *
  18.  * OUTPUT
  19.  * profitMargin
  20.  * salePrice : MPG car can travel
  21.  *
  22.  **************************************************************/
  23. #include <iostream>
  24. #include <iomanip>
  25. using namespace std;
  26. int main ()
  27. {
  28. float oemPrice; //INPUT - Original Production Cost
  29. float oemPriceBy2; // INPUT - Original Production / by 2
  30. float profitMargin;// OUTPUT - Net Profit Margin Percentage
  31. float salePrice; //OUTPUT - Final Sale Price of Product
  32. //
  33. // Initialize Program Variables
  34. oemPrice = 12.67;
  35. //
  36. // Compute Final Sale Price & Net Profit Margin
  37. oemPriceBy2 = oemPrice / 2;
  38. salePrice = oemPriceBy2 * 5;
  39. profitMargin = oemPrice / salePrice;
  40. //
  41. // Output Result
  42. cout << "The company would have to sell the circuit boards at $"
  43. << salePrice << "." << endl << "To see a net profit margin of "
  44. << profitMargin << " which is 40% above production cost." << endl;
  45. return 0;
  46. }
Success #stdin #stdout 0.01s 5296KB
stdin
Standard input is empty
stdout
The company would have to sell the circuit boards at $31.675.
To see a net profit margin of 0.4 which is 40% above production cost.