Question
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 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). Hint: Use the value 0.02 to represent 2 percent, and 0.04 to represent 4 percent.
Can anybody help me?
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 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). Hint: Use the value 0.02 to represent 2 percent, and 0.04 to represent 4 percent.
Can anybody help me?
Answers
Post either pseudocode, or actual coding, in whatever shape they are in.
If you do not know how to do either one of the two, post what you have learned, the name of your textbook, the chapters covered, and the course outline.
If you do not know how to do either one of the two, post what you have learned, the name of your textbook, the chapters covered, and the course outline.
// Create a Scanner object to read input.
Scanner keyboard = new Scanner(System.in);
// Get the Purchase Amount
System.out.print(" What is the Purchase Amount?");
purchaseAmount=keyboard.nextDouble( );
stateSalesTax=0.04*purchaseAmount;
countySalesTax=0.02*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 +"\n_________");
System.out.println( " Total Sale " + totalSale);
}
}
Scanner keyboard = new Scanner(System.in);
// Get the Purchase Amount
System.out.print(" What is the Purchase Amount?");
purchaseAmount=keyboard.nextDouble( );
stateSalesTax=0.04*purchaseAmount;
countySalesTax=0.02*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 +"\n_________");
System.out.println( " Total Sale " + totalSale);
}
}
A customer is in a store to purchase 6 items. Write a program which asks for the sales tax and the price of each item, then displays: 1. the subtotal of the sale 2. the total amount of tax to be collected 3. the total amount the customer must pay
Related Questions
As a beginner, you should be beginning with regular verbs. I also have exercises, should you wish to...
I'm a beginner in the subject. It's a category that is overviewed in my AP Chem class. I need some h...
How might a beginner or someone who does not have experience confuse the following advance directive...
For beginner parachutists, the terminal velocity must be less than 5.00 m/s, and the parachutes used...
Mookie4571
Beginner (16)
Which of the following sentences uses passive voice appropriate...
Hi,I'm an absolute beginner in this field and this may be a dumb idea.But as mind came up with this,...
Claire is a beginner when it comes to photo editing which is why she is starting off with a type of...
Claire is a beginner when it comes to photo editing which is why she is starting off with a type of...
Claire is a beginner when it comes to photo editing which is why she is starting off with a type of...
how to say in a beginner friendly way in japanese: "My family will buy a dog in a few weeks. It will...