fork download
  1. // Jeremy Huang CS1A Chapter 2, Pp. 81, #2
  2.  
  3. /*****************************************************************************
  4.  * PREDICT SALES
  5.  * ____________________________________________________________________________
  6.  * This program calculates the expected sales generated by a specific division
  7.  * of a company based on its percentage contribution to total sales. The user
  8.  * provides the company’s total annual sales and the division’s sales
  9.  * percentage. The program then applies the percentage to the total sales figure
  10.  * ouputs the amount of revenue the division generates.
  11.  * ___________________________________________________________________________
  12.  * INPUT
  13.  * totalSales : company's total annual sales
  14.  * divisionPerc : percentage of total sales generated by the division
  15.  *
  16.  * OUTPUT
  17.  * salesPredict : projected amount of sales division generates
  18.  *
  19.  * **************************************************************************/
  20.  
  21.  
  22.  
  23. #include <iostream>
  24. using namespace std;
  25.  
  26. int main() {
  27. //Declaring variables
  28. int totalSales = 4600000;
  29. float divisionPerc = 0.62;
  30.  
  31. //Computing sales made
  32. float salesPredict = totalSales * divisionPerc;
  33.  
  34. //Output
  35. cout<<"The East Coast division will generate $"<<salesPredict;
  36. cout<<" in sales this year.";
  37.  
  38. //End program
  39. return 0;
  40. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
The East Coast division will generate $2.852e+06 in sales this year.