Computer Science

posted by .

Design a program that will ask the user to enter the amount of a purchase. The program should the compute the state and county sales tax. Assume the state sales 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 of purchase plus the total sales tax).
*I'm so lost. It gives me errors every time I attempt this on NetBeans IDE. Help!!!

  • Computer Science -

    I used NetBeans IDE 7.1.2 and this worked:

    package purchaseamount;

    import java.util.Scanner;

    /**
    *
    * @author AB
    */
    public class PurchaseAmount {

    /**
    * @param args the command line arguments
    */
    public static void main(String[] args) {
    double purchaseAmount;
    double stateSalesTax = 0.04;
    double countySalesTax = 0.02;
    double totalSalesTax;
    double totalSale;

    Scanner keyboard = new Scanner(System.in);
    System.out.print("What is the purchase amount? ");
    purchaseAmount = keyboard.nextDouble();



    stateSalesTax = stateSalesTax * purchaseAmount;
    countySalesTax = countySalesTax * purchaseAmount;
    totalSalesTax = stateSalesTax * countySalesTax;
    totalSale = totalSalesTax + purchaseAmount;

    System.out.println("Purchase " + purchaseAmount);
    System.out.println("State Tax " + stateSalesTax);
    System.out.println("County Tax " + countySalesTax);
    System.out.println("Total Tax " + totalSalesTax);
    System.out.println("Total Sale " + totalSale);
    }
    }

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. Computer Programming Design

    Design a program that will ask the user to enter the amount of a purchase. The program should then compute the state and county tax. Assume the state sales tax is 4 percent (.04) and the county tax is 2 percent (.02). The program should …
  2. Compter programing Design

    Design a program that will ask the user to enter the amount of a purchase. The program should the compute the state and county sales tax. Assume the state sales tax is 4 percent and the county sales tax is 2 percent. The program should …
  3. Java Programming

    I'm a beginner to Java and I need to know how to do the following: Write a program that will ask the user to enter the amount of a purchase. The program should then compute the state and county sales tax. Assume the state sales tax …
  4. Computer class

    how do I design a program using a flowchart, the program needs to compute state and county sales tax?
  5. logic and design

    You have been contracted by a local antique store to design an algorithm determining the total purchases and sales tax. According to the store owner, the user will need to see the subtotal, the sales tax amount, and the total purchase …
  6. programming

    a sales report. Each record in the file contains a customer's number and name, a sales amount and a tax code. The tax code is to be applied to the sales amount to determine the sales tax due for that sale, as follows: Tax code Sales …
  7. programming

    Design a program and write program that will read a file of sales records and produce a sales report. Each record in the file contains a customer's number and name, a sales amount and a tax code. The tax code is to be applied to the …
  8. Programming c++

    a sales report. Each record in the file contains a customer's number and name, a sales amount and a tax code. The tax code is to be applied to the sales amount to determine the sales tax due for that sale, as follows: Tax code Sales …
  9. computer science

    Write a program that will ask the user to enter the amount of a purchase. The program should then compute the state and county sales tax. Assume the state sales tax is 4 percent and the county sales tax is 2 percent. The program should …
  10. programming

    Write a program that will ask the user to enter the amount of a purchase. The program should then compute the state and county sales tax. Assume the state sales tax is 4 percent and the county sales tax is 2 percent. The program should …

More Similar Questions