/* Program 2.2: Compute Sales Tax on Purchase */ /* Author: Dr. Michael A. Redmond */ /* Date: 09/02/99 */ #include int main() { /* define constants and variables */ const double taxRate = 0.06; double purchasePrice; double tax; double total; /* Students - this is start of real work! */ /* get purchase info from user */ printf("What is the purchase price? "); scanf("%lf",&purchasePrice); /* calculate amount of tax and total price */ tax = purchasePrice * taxRate; total = purchasePrice + tax; /* display results */ printf("Sales tax on $ %6.2f is $ %5.2f for a total of ==> $ %7.2f \n", purchasePrice,tax,total); return 0; }