Write a main Program that computes the total sales on a 95 p

Write a main Program that computes the total sales on a $95 purchase. Assume that the state sale tax is 6.5% and the county sale tax is 2%. Display the purchase price, sale tax, county tax, and the total amount on the screen.

Solution

//TaxProgram.java

public class TaxProgram {

   public static void main(String[] args) { // main program
      
       double purchase = 95; // double type of value purchase
       double stateSalesTax = 6.5; //salesTax
       double countrySalesTax = 2; //countryTax
      

//Printing Purchase, Sales and Country Tax on Screen
       System.out.println(\"Purchase Price is:$\"+purchase);
      
       System.out.println(\"State Sales Tax is:\"+stateSalesTax+\"%\");
      
       System.out.println(\"Country Sales Tax is:\"+countrySalesTax+\"%\");
      

//Calculating State and Country Sales tax amount
       double stateAmount = purchase * (stateSalesTax/100);
       double countryAmount = purchase * (countrySalesTax/100);
      
       double totalTax = stateAmount+countryAmount;
//Calculating Total amount for purchase
       double totalAmount = purchase + totalTax;
//Printing Total Amount, State Amount, Country Amount
       System.out.println(\"State Tax is:$\"+stateAmount);
       System.out.println(\"Country Tax is:$\"+countryAmount);
       System.out.println(\"Total Amount is:$\"+totalAmount);
   }

}

Output:

Purchase Price is:$95.0
State Sales Tax is:6.5%
Country Sales Tax is:2.0%
State Tax is:$6.175
Country Tax is:$1.9000000000000001
Total Amount is:$103.075

 Write a main Program that computes the total sales on a $95 purchase. Assume that the state sale tax is 6.5% and the county sale tax is 2%. Display the purchas

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site