fork download
  1. // Eric Bernal Chapter 2, P. 81 #3 CS1A
  2. /******************************************************************************
  3. Compute total transaction
  4. *_______________________________________________________________________________
  5. This program will calculate the total amount of a transaction including tax.
  6.  
  7. Computation is based on this formula:
  8. Total = Purchase x State Tax x Country Sale Tax
  9. *_______________________________________________________________________________
  10. INPUT
  11. Purchase : Purchase amount before tax
  12. Statetax : State tax
  13. Countrytax : Country's sale tax
  14.  
  15. OUTPUT
  16. Total : Total amount after all taxes
  17. *******************************************************************************/
  18. #include <iostream>
  19. using namespace std;
  20.  
  21. int main() {
  22. float Purchase; //INPUT: Purchase amount before tax
  23. float Statetax; // INPUT: State tax
  24. float Countrytax; //INPUT : Country sale tax
  25. float Total; // OUTPUT : Total amount including tax
  26.  
  27. // Program Variables
  28. Purchase = 52;
  29. Statetax = 4;
  30. Countrytax = 2;
  31. // Total formula computation
  32. Total = Purchase * Statetax * Countrytax;
  33. //Output result
  34. cout << "The total amount is " << Total << endl;
  35.  
  36. return 0;
  37. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
The total amount is 416