Java programming

  • Print Article |
  • Send to a Friend |
  • |
  • Add to Google |

Write a program that will ask the user to enter  the amount of a purchase. The prgram should then compute the state and county sales tax. Assume the state tax is 4 percent and the county sales tax is 2 percent. The program should display the amount of the purchase, the state sales tax, the county sales tax, the total sales tax, and the total of the sale (which is the sum of the amount od purchase plus the total sales tax).

the java programming method to this is

// This program calculates the sales tax on a item.

public class SalesTax
{
   public static void main(String[] args)
   {
       double price;

       price = 20.00;
       System.out.println("The price of the item is " + price);

       double value1 = 0.02;

       double state_tax = value1 * price;
       System.out.println("The state tax on the item is $ " + state_tax);

       double value2 = 0.04;

       double county_tax = value2 * price;
       System.out.println("The county tax on the item is $" + county_tax);

        double total_sales_tax = state_tax + county_tax;
       System.out.println("The total sales tax on the item is $" + total_sales_tax);

        double total_sale_of_item = total_sales_tax + price;
        System.out.println("The total sale of the item is $" + total_sale_of_item);
    }
 }

Article Rating (5 stars):
  • article full star
  • article full star
  • article full star
  • article full star
  • article full star
Rate this Article:
  • Article Word Count: 220
  • |
  • Total Views: 543
  • |
  • permalink
  • Print Article |
  • Send to a Friend |
  • |
  • Add to Google |
>