In: Computer Science
Monthly Sales Tax Program
A retail company must file a monthly sales tax report listing the total sales for the month and the amount of state and county sales tax collected. The state sales tax rate is 4 percent and the county sales tax rate is 2 percent. Write a program that asks the user to enter the total sales for the month. The application should calculate and display the amount of county sales tax, the amount of state sales tax, and the total sales tax.
Your program must use the following functions, no more, no less and all variables must be local variables
main() – Calls all the other functions inputTotalSales() – Asks the user for total sales for the month calculateTaxes() – Calculates the State and County sales tax displayTaxes() – Displays the taxes
i want the program to work, but i need one error in the program.
C Code:-
#include<stdio.h>
#include<conio.h>
//Function definition
void inputTotalSales(double* sales)
{
printf("Enter total sales: ");
scanf("%lf", sales);
}
void calculateTaxes(double* stateTax, double* countryTax, double
sales)
{
*stateTax = sales * 0.05;//calculation is wrong it should be
0.04.(has put this as per your request.)
*countryTax = sales * 0.02;
}
void displayTaxes(double stateTax, double countryTax)
{
printf("State sale tax: %.2lf\nCountry sales tax: %.2lf\nTotal
sales tax: %.2lf\n"
, stateTax, countryTax, (stateTax + countryTax));
}
//main functions
int main()
{
double sales, stateTax, countryTax;
//calling the functions
inputTotalSales(&sales);
calculateTaxes(&stateTax, &countryTax, sales);
displayTaxes(stateTax, countryTax);
}
Output:-
Screenshot of Code:-
As u have not mentioned any programming language i did it in c .
if u like my answer then please give a thumbs up..!!