Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

To complete the assignment, create a project with NetBeans. Remove the comments

ID: 3744279 • Letter: T

Question


To complete the assignment, create a project with NetBeans.
Remove the comments generated by NetBeans.
At the top of your Java file, write a comment that includes your name and
the last date you worked on the program.
Variable names start with a lower-case character.
Use NetBean’s format feature to indent the code.
Submit ComputeTax.java via Canvas.
Assignment:
Add a Java file to your NetBeans project called ComputeTax.java.
Declare a Scanner variable that will allow you to read data from the
keyboard. (See the appendix at the end of these notes.)
Declare a double variable called salary.
Prompt the user to enter a value for salary. Store this value in salary.
Example: salary = in.nextDouble();
Declare a double variable called tax. Use the table below to compute the
tax for the entered salary.
Use the following table to compute the tax for this salary:
Salary Tax Rate
$20,000 or less 2% of salary
$20,000.01 to $40,000 $400 + 3% of (salary - 20,000)
$40,000.01 to $60,000 $1000 + 4% of (salary - 20,000)
$60,000.01 to $80,000 $1800 + 5% of (salary - 60,000)
More than $80,000 $2800 + 6% of (salary - 80,000)
For instance, if the user enters a salary equal to 25,000 then their tax
liability is 400 + (25,000 – 20,000.0)*.03 which is $550.00

Use “else if” statements to determine the tax. First determine if the salary
is greater than or equal to 20,000, then determine if the salary is greater
than 40,000, etc.
Display the salary and computed tax in a readable format.
Example:
Your salary is $25000.00
Your tax is $550.00
Appendix:
(i) To read in the salary from the keyboard:
import java.util.Scanner;
public class ComputeTax{
public static void main(String[] args){
Scanner in = new Scanner(System.in);
System.out.println("Enter your salary"); // Inserted on 9/6
double salary = in.nextDouble();
(ii) Displaying data with two decimal places of accuracy
The following statement will display the salary with two decimal places of
accuracy: System.out.printf("Your salary is %.2f ", salary);
The following statement will display the tax with two decimal places of accuracy:
System.out.printf("Your tax is %.2f ", tax);

Explanation / Answer

import java.util.Scanner; public class ComputeTax { public static void main(String[] args) { Scanner in = new Scanner(System.in); System.out.println("Enter your salary"); double salary = in.nextDouble(); double tax; if(salary
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote