Question

In: Computer Science

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.

C programming

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
 
 

Solutions

Expert Solution

Step 1: Examine the following algorithm.

  1. Get the total sales for the month.    
  2. Multiply the total sales by .04 to calculate the state sales tax.  
  3. Multiply the total sales by .02 to calculate the county sales tax.              
  4. Add the state tax and county tax to calculate the total sales tax.
  5. Display the calculated county tax, state tax, and total sales tax.

Step 2: Given a total sales of $27,097, answer the following:

The calculated state tax =1083.88

The calculated county tax =541.94

The calculated total tax=1625.82

Below are variable names and its purpose

1)Declare Real total Sales-Stores total sales the user inputs

2)Declare real countyTax-Stores county tax

3)Declare real stateTax-Stores state tax

4)Declare real totalTax-Stores total tax

Step 2: Given the major task involved in this program, what modules might you consider including.We Describe the purpose of each module

1)Module inputData () - Allows the user to enter required user input

2) Module calcCounty () - Calc county tax

3)Module calcState () - Calc state tax

4)Module calcTotal () - Calc total tax

5)Module printTax () - Print tax

Step 3: Complete the pseudocode by writing the missing lines Also, when writing your modules and making calls, be sure to pass necessary variables as arguments and accept them as reference parameters if they need to be modified in the module.

Module main ()

     //Declare local variables

     Declare Real totalSales

     Declare Real countyTax

     Declare real stateTax

     Declare Real totalTax

    

     //Function calls

     Call inputData(totalSales)

     Call calcCounty(totalSales, countyTax)

     Call calcState (totalSales, stateTax)

     Call calcTotal (totalSales, countyTax, stateTax, calctotal)

End Module

//this module takes in the required user input

Module inputData(Real Ref totalSales)

     Display “Enter the total sales for the month.”

     Input totalSales

End Module

//this module calculates county tax

//totalSales can be a value parameter because it is not

//changed in the module.

//countyTax must be a reference parameter because it is

//changed in the module

Module calcCounty(Real totalSales, Real Ref countyTax)

countyTax = totalSales * .02

­­­­­­­­­­­End Module

//this module calculates state tax

calcCounty(Real totalSales, Real Ref totalTax)

totalTax = totalSales * .06

End Module

//this module calculates total tax

Module calctotal real ref totalSales real stateTax real countyTax

calcCounty(Real totalSales, Real Ref totalTax)

totalTax = totalSales * .06

End Module

//this module prints the total, county, and state tax

Module

End Module

/*
Description: This program calculates the total price which includes sales tax
*/
import java.util.Scanner;

public class SalesTax
{
        public static void main(String[] args)
        {
                //identifier declarations
                final double TAX_RATE = 0.055;  // Sales Tax Rate CONSTANT
        
                double price;  //price of the item (input)
                double tax;    //tax (calculated using price * TAX_RATE)
                double total;  // total owed (calculated using  price + tax)
                String item;   // name of the item purchased

                //create a Scanner object to read from the keyboard
                Scanner keyboard = new Scanner(System.in)

                //display prompts and get input
                System.out.print("Item description:  "); // prompt for item
                item = key.nextLine(); // read & store item as entered by user
                System.out.print("Item price:  $"); // prompt for price
                price = keyboard.nextDouble(); // read & store price
                
                //calculations
                tax = price * TAX_RATE;     // calculate & store value for tax
                total = price + tax;     // calculate & store value for total
                
                //output results
                System.out.println("Item purchased: " + item);
            out.println("Price                 $" + price);
                System.out.println("Tax                   $" + tax);
                system.out.println("Total                 $" + total);
        }
}

Related Solutions

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.
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 5 percent and the county sales tax rate is 3 percent. Create a GUI application that allows the user to enter the total sales for the month into a text field. From this figure, the application should calculate and display the following: The number of county sales tax...
A retail company must file a monthly sales tax report listing the sales for the month and the amount of sales tax collected.
make it in C++ with pointerA retail company must file a monthly sales tax report listing the sales for the month andthe amount of sales tax collected. Write a program that asks for the month, the year,and the total amount collected at the cash register (that is, sales plus sales tax). Assumethe state sales tax is 4 percent and the county sales tax is 2 percent.If the total amount collected is known and the total sales tax is 6 percent,...
A retail company must file a monthly sales tax report listing the sales for the month and the amount of sales tax collected.
Must be done in Visual StudiosA retail company must file a monthly sales tax report listing the sales for the month and the amount of sales tax collected. Write a program that asks for the month, the year, and the total amount collected at the cash register (that is, sales plus sales tax). Assume the state sales tax is 4 percent and the county sales tax is 2 percent.If the total amount collected is known and the total sales tax...
Monthly Sales Tax A retail company must file a monthly sales tax report listing the total...
Monthly Sales Tax 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 5 percent and the county sales tax rate is 2.5 percent. Write a Python program with function(s) that asks the user to enter the total sales for the month. Make sure that you do not allow user to enter negative values for the total...
A retail company must file a monthly sales tax report listing the total sales for the...
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% and the county sales tax rate is 2%. Create an application that allows the user to enter the total sales from the month. From this figure, the application should calculate and display the following: 1. The amount of country sales tax 2. The amount of state...
Monthly Sales Tax Program A retail company must file a monthly sales tax report listing the...
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...
Stine Co. is a retail store operating in a state with a 6% retail sales tax.
Stine Co. is a retail store operating in a state with a 6% retail sales tax. The retailer may keep 2% of the sales tax collected. Stine Co. records the sales tax in the Sales account. The amountrecorded in the Sales account during May was $148,400. 99. The amount of sales taxes (to the nearest dollar) for May isa. $8,726. b. $8,400. c. $8,904. d. $9,438.The amount of sales taxes payable (to the nearest dollar) to the state for the...
Vaughn Co. is a retail store operating in a state with a 7% retail sales tax....
Vaughn Co. is a retail store operating in a state with a 7% retail sales tax. The retailer may keep 2% of the sales tax collected. Vaughn Co. records the sales tax in the Sales Revenue account. The amount recorded in the Sales Revenue account during May was $747930. The amount of sales taxes payable (to the nearest dollar) to the state for the month of May is $37307. $47951. $51310. $61874.
Sales tax is collected from buyers and remitted to the government. A retailer has to file...
Sales tax is collected from buyers and remitted to the government. A retailer has to file a monthly sales tax report which lists the sales for the month and the amount of sales tax collected, at both the county and state levels. Develop a program that will input the total collections for a month, calculate the sales tax on the collections, and display the county and state taxes. Assume that states have a 4% sales tax and countries have a...
Winfield Company operates a retail store a) Below is a table containing monthly sales and sales...
Winfield Company operates a retail store a) Below is a table containing monthly sales and sales staff compensation, in dollars for the previous year. Use the high-low method to create an equation in the form Y = a+ bX to describe the behavior of sales staff compensation. Month Comp Sales 1 412,700 1,808,000 2 386,000 1,659,000 3 359,700 1,512,000 4 346,500 1,138,000 5 359,400 1,218,900 6 341,000 1,233,000 7 366,500 1,409,300 8 364,200 1,437,000 9 400,100 1,616,600 10 443,000 1,833,000...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT