fork download
  1. //Ryan Shahriyarpour CS1A Carl Argila CH2 HW Q:3
  2. //
  3. /*****************************************************************************
  4.  *
  5.  * Computing Sales Tax
  6.  *
  7.  *
  8.  * *******
  9.  * The goal of the program is to find out and compute the total sales tax on a
  10.  * $52 purchase by using a state tax of 4% and a county tax of 2%
  11.  *
  12.  *
  13.  * In order to find this, the program will compute the following:
  14.  * stateTax = purchase * 0.04
  15.  * countyTax = purchase * 0.02
  16.  * totalTax = stateTax + countyTax
  17.  *
  18.  *
  19.  * *******
  20.  *
  21.  * INPUT
  22.  * purchase : $52
  23.  * state tax : 4 percent
  24.  * county tax: 2 percent
  25.  *
  26.  * OUTPUT
  27.  * total tax : The total sales tax
  28.  *
  29.  *****************************************************************************/
  30.  
  31. #include <iostream>
  32.  
  33. int main() {
  34. // Specify the numbers and assign them to variables
  35. double purchase = 52.00;
  36. double stateTax = 0.04;
  37. double countyTax = 0.02;
  38.  
  39. // Compute the taxes and store the total in a variable
  40. double totalTax = purchase * stateTax + purchase * countyTax;
  41.  
  42. // Show the output
  43. std::cout << "The total sales tax is $" << totalTax << std::endl;
  44.  
  45. return 0;
  46. }
Success #stdin #stdout 0s 5324KB
stdin
Standard input is empty
stdout
The total sales tax is $3.12