fork download
  1. //Taylor Johnson CS1A Chapter 2, P.83, #13
  2. /******************************************************************************
  3.  * Compute Circuit Board selling price using profit margain and cost
  4.  *
  5.  * ____________________________________________________________________________
  6.  * This program computes the price a company sells their Circuit Boards for
  7.  * including the cost and prefered profit.
  8.  *
  9.  * This program will compute by using the formula:
  10.  * Profit = cost * profitPerc
  11.  * sellPrice = cost + profit
  12.  * ____________________________________________________________________________
  13.  * INPUT
  14.  * cost : price company paid per circuit board
  15.  * profitPerc : the percent profit the company makes per sale
  16.  *
  17.  * OUTPUT
  18.  * sellPrice : Price company sells circuit board to comsumer
  19.  * ***************************************************************************/
  20.  
  21.  
  22.  
  23.  
  24. #include <iostream>
  25. using namespace std;
  26.  
  27. int main()
  28. {
  29. //create variables and assign values for cost and profit percentage of the cost
  30. float sellPrice, profit, cost = 12.67, profitPerc = 0.40;
  31. // your code goes here
  32. //Multiply the cost and profPerc to get profit per unit
  33. profit = cost * profitPerc;
  34. // add the profit per unit to cost resulting in the sellprice
  35. sellPrice = cost + profit;
  36. cout << "the cost of one circuit board is $" <<sellPrice<< "!" << endl;
  37. return 0;
  38. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
the cost of one circuit board is $17.738!