78.7k views
4 votes
in java 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 following: • The amount of county sales tax • The amount of state sales tax • The total sales tax (county plus state)

User EngrEric
by
3.9k points

2 Answers

5 votes

Answer:

Step-by-step explanation:

User Andy Tschiersch
by
4.6k points
3 votes

Answer:

  1. import java.util.Scanner;
  2. public class Main {
  3. public static void main(String[] args) {
  4. Scanner input = new Scanner(System.in);
  5. System.out.print("Input total sales of month: ");
  6. double totalSales = input.nextDouble();
  7. double stateTax = totalSales * 0.04;
  8. double countyTax = totalSales * 0.02;
  9. double totalSalesTax = stateTax + countyTax;
  10. System.out.println("County Tax: $" + countyTax);
  11. System.out.println("State Tax: $" + stateTax);
  12. System.out.println("Total Sales Tax: $" + totalSalesTax);
  13. }
  14. }

Step-by-step explanation:

Firstly, create a Scanner object and prompt user to input total sales of month (Line 5-7). Next, apply the appropriate tax rate to calculate the state tax, county tax (Line 9 - 10). Total up the state tax and county tax to get the total sales tax (Line 11).

At last, print the county tax, state tax and the total sales tax (Line 13 - 15).

User Danial Tz
by
3.8k points