Computer Science

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!!!

  1. 👍 0
  2. 👎 0
  3. 👁 646
  1. 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.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);

    1. 👍 0
    2. 👎 0

Respond to this Question

First Name

Your Response

Similar Questions

  1. Programming

    Write a pseudocode to represent the logic of a program that allows a user to enter an hourly pay rate and hours worked. The program outputs the user's gross pay

  2. Programming concepts

    Develop a menu-driven program that inputs two numbers and, at the user’s option, finds their sum, difference, product, or quotient. top-down modular approach and pseudocode to design a suitable program to solve it. I am having

  3. C++

    // Program: name of program // Author: your name // Date Written: date you began writing the program /* Abstract: Brief description of the program */ Include in-line comments in the body of your program. You can convert

  4. java programming

    1. Time Calculator Write a program that asks the user to enter a number of seconds. • There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the

  1. Programming Logic and Design (help?)

    Design a retirement planning calculator for Skulling Fincancial Services. Allo a user to enter a number of working years remaining in the user's career and the annual amount of money the user can save. Assume that the user earns

  2. programming logic and design

    I need help writing pseudocode for this problem: Design a retirement planning calculator for skulling financial services • Allow a user enter a number of working years remaining in the user career and the annual amount of money

  3. Programming logic and design

    Design a program that lets the user enter the total rainfall for each 12 months into an array. The program should calculate and display the total rainfall for the year the average monthly rainfall, and the month with the highest

  4. Programming

    Draw a flowchart or write pseudo code to represent the logic of a program that allows the user to enter values for the current year and the user’s birth year. The program outputs the age of the user this year. Preferably a

  1. computer programming

    Design the pseudocode for a program that allows a user to enter 10 numbers, then displays them in the reverse order of their entry

  2. Computer Science

    Write a program that Will prompt a user to enter his/her name and number.use a while loop that will display the user name times the entered number

  3. Programming and Design

    Draw the hierarchy chart and design the logic for a program that calculates the projected cost of an automobile trip. Assume that the user's car travels 20 miles per gallon of gas. Design a program that prompts the user for a

  4. computer programming

    Design the logic for a program that allows a user to enter 10 numbers, then displays each and its difference from the numeric average of the numbers

You can view more similar questions or ask a new question.