fork download
  1. //Jacob Silvestre CSC5 Chapter 2, P. 81, #3
  2. //
  3. /*************************************************************************
  4.  *
  5.  * COMPUTE SALES TAX
  6.  * ____________________________________________________________
  7.  * This program computes the total sales tax on a $52 purchase with
  8.  * a state tax rate of 4 percent and county tax of 2 percent.
  9.  *
  10.  * Computation is based on the formula:
  11.  * totalTax = .04 * 52 + .02 * 52
  12.  * ____________________________________________________________
  13.  * INPUT
  14.  * 52 : cost of purchase
  15.  * .04 : state tax rate
  16.  * .02 : county tax rate
  17.  *
  18.  * OUTPUT
  19.  * totalTax : total sales tax
  20.  *
  21.  *************************************************************************/
  22. #include <iostream>
  23. using namespace std;
  24.  
  25. int main()
  26. {
  27. double totalTax; //OUTPUT - Total sales tax
  28.  
  29. //
  30. //Calculate total Sales tax
  31. totalTax = .04 * 52 + .02 * 52;
  32.  
  33. //
  34. // Output Result
  35. cout << "The total sales tax is $"<< totalTax << endl;
  36.  
  37. return 0;
  38. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
The total sales tax is $3.12