fork download
  1. //Diego Martinez CSC5 Chapter 2, P. 84,#18
  2.  
  3. /*******************************************************************************
  4. * Calculating Energy Drink Consumption
  5. * ______________________________________________________________________________
  6. * This program calculates the amount of people that purchases one or more
  7. * energy drink a week and computes how many prefer the citrus flavored energy
  8. * drinks.
  9. *
  10. * Computation is based on the Formula:
  11. * Energy Drink Customers = Total Customers * Energy Drink Percentage
  12. * Citrus Customers = Energy Drink Customers * Citrus Percentage
  13. *_______________________________________________________________________________
  14. * INPUT
  15. * totalCustomers : Total customers surveyed
  16. * energydrinkPercent : The Percent of Customers the purchase weekly
  17. * citrusPercent : Percent that prefers the citrus flavor
  18. *
  19. * OUTPUT
  20. * energyDrinkCustomers : Weekly Customers
  21. * citrusCustomers : Citrus Customers
  22. *******************************************************************************/
  23.  
  24. #include <iostream>
  25. using namespace std;
  26.  
  27. int main()
  28. {
  29. //Total Number of Surveyed Customers
  30. int totalCustomers = 12467;
  31.  
  32. //Percentages
  33. double energyDrinkPercent = 0.14;
  34. double citrusPercent = 0.64;
  35.  
  36. //Calculations
  37. double energyDrinkCustomers = totalCustomers * energyDrinkPercent;
  38. double citrusCustomers = energyDrinkCustomers * citrusPercent;
  39.  
  40. //Output results
  41. cout << "Approximate number of customers who purchase one or more energy drink per week: "
  42. << energyDrinkCustomers << endl;
  43. cout << "Approximate number of customers citus flavored energy drinks: "
  44. << citrusCustomers << endl;
  45.  
  46. return 0;
  47. }
Success #stdin #stdout 0.01s 5252KB
stdin
Standard input is empty
stdout
Approximate number of customers who purchase one or more energy drink per week: 1745.38
Approximate number of customers citus flavored energy drinks: 1117.04