Question
JAVA NETBEANS IDE (50 points) Sales Tax: Write a class SalesTax that will calculate the sales tax on a purchase. (This should be similar to
JAVA NETBEANS IDE (50 points) Sales Tax: Write a class SalesTax that will calculate the sales tax on a purchase. (This should be similar to the BankAccount class on pages 96 and 97). There should be a constructor that accepts as input the state sales tax rate and the county sales tax rate. These will be two different inputs (2 parameters). (6 points) Write a method that calculates the sales tax. This method should accept as input the price of the purchase (this will be used later so it needs to be assigned to a variable belonging to the class an instance variable) and calculate the total sales tax charged on the purchase. (7 points) There should be another method that calculates the total cost by adding the initial purchase (variable you received in previous method) and the sales tax. (7 points) There should be a method to return sales tax. (5 points) There should be a method to return the total cost. (5 points) Write a tester class that asks the user to input the purchase price. The tester class should use a state sales tax rate of 6 percent and a local sales tax rate of 4 percent. (These are input to the SalesTax class). (20 points) Create an object using the sales taxes given. Execute the method to calculate the total sales tax using the input. Execute a method to calculate the total product cost. Print the original price, the total sales tax, and the total cost of the product. Also print the expected total sales tax and the expected total cost of the product.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started