fork download
  1. //Xinnuo Wang CS1A chapter6 Page.369 #1
  2. /*******************************************************************************
  3.  *
  4.  * Display Retail Price
  5.  * _____________________________________________________________________________
  6.  * The program accepts an item's wholesale and markup percentage and diplays
  7.  * it's retail price.
  8.  *
  9.  * _____________________________________________________________________________
  10.  * Input
  11.  * Wholesale Cost : The accepted wholesale cost of the item
  12.  * Markup Percentage : The accepted markup percentage of the item
  13.  *
  14.  * Output
  15.  * Retail Price : The retail price of the item
  16.  *
  17.  * ****************************************************************************/
  18. #include <iostream>
  19. using namespace std;
  20. double calculateRetail(double,double);//Prototype
  21. int main()
  22. {
  23. double wholesaleCost, markupPercentage;
  24. cout << "Enter the item's whole sale and markup percentage in percent" << endl;
  25. cin >> wholesaleCost >> markupPercentage;
  26. cout << calculateRetail(wholesaleCost,markupPercentage);//call function
  27. return 0;
  28. }
  29. double calculateRetail(double wholesaleCost,double markupPercentage)
  30. {
  31. double retailPrice;
  32. retailPrice = wholesaleCost * (1 + markupPercentage/100);
  33. return (retailPrice);
  34. }
  35.  
Success #stdin #stdout 0.01s 5292KB
stdin
10 50
stdout
Enter the item's whole sale and markup percentage in percent
15