fork download
  1. //Amari Mosley CSC5 Chapter 2, P. 81, #3
  2. //
  3. /**************************************************************
  4.  *
  5.  * SALES TAX COMPUTATION
  6.  * ____________________________________________________________
  7.  * This program will compute the total sales tax on a $52 purchase.
  8.  
  9.  * Computation is based on the formula:
  10.  * StateTaxAmount = PurchaseAmount * StateTax;
  11.   CountyTaxAmount = PurchaseAmount * CountyTax;
  12.   SalesTax = StateTaxAmount + CountyTaxAmount;
  13.  
  14.  * ___________________________________________________________
  15.  * INPUT
  16.  *
  17.  * PurchaseAmount : The Amount of Money the Purchase is worth
  18.  
  19. StateTax : The Tax Percentage the State Imposes
  20.  
  21. CountyTax : The Tax Percentage the County Imposes
  22.  *
  23.  * OUTPUT
  24.  * StateTaxAmount : Total amount of state taxes being paid
  25. CountyTaxAmount : Total amount of county taxes being paid
  26. SalesTax : The Total Amount of Taxes
  27.  *
  28.  **************************************************************/
  29. #include <iostream>
  30. #include <iomanip>
  31. using namespace std;
  32.  
  33. // Defining Main Function
  34. int main()
  35.  
  36. {
  37. // Defining double Variables
  38. double PurchaseAmount, StateTax, CountyTax, StateTaxAmount, CountyTaxAmount, SalesTax;
  39.  
  40. // Assigning Values of Variables
  41. PurchaseAmount = 52;
  42. StateTax = .04;
  43. CountyTax = .02;
  44.  
  45.  
  46. //Computing Product of Values
  47. StateTaxAmount = PurchaseAmount * StateTax;
  48. CountyTaxAmount = PurchaseAmount * CountyTax;
  49. SalesTax = StateTaxAmount + CountyTaxAmount;
  50.  
  51. //Final Generation Display
  52. cout << "The total taxes on the purchase comes out to " << SalesTax << " dollars. ";
  53.  
  54. return 0;
  55. }
Success #stdin #stdout 0.01s 5292KB
stdin
Standard input is empty
stdout
The total taxes on the purchase comes out to 3.12 dollars.