Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is for Java. 2. Write a static method named tax that accepts a salary as a parameter and that returns the amount of federal
This is for Java.
2. Write a static method named tax that accepts a salary as a parameter and that returns the amount of federal tax you would owe if you make that salary. The tax is computed based on your tax bracket as found from the first two columns below. Once you know which row of the table to use, start with the "flat amount" and add the "plus %" of the amount over the amount listed in the final column. For example, if your income is $50,000, then you use the third row of the table and compute the tax as $4,000 plus 25% of the amount over $29,050, which comes to $9,237.50. The total tax on $27,500 is $3,767.50. For $6,000, the tax is $600. For $120,000, the tax is $28,227. over but not over flat amount plus % of excess over $0 $7,150 $0 10% $0 $7,150 $29,050 $715 15% $7,150 $29,050 $70,350 $4,000 25% $29,050 $70,350 unlimited $14.325 28% $70,350 You may assume that your method is passed a value greater than or equal to 0. Finish the following code file: public class TestTax { public static void main(String[] args) { System.out.println("The tax on $50000 is " + tax (50000)); System.out.println("The tax on $27500 is " + tax (27500)); System.out.println("The tax on $6000 is " + tax (6000)); System.out.println("The tax on $120000 is " + tax (120000)); // 9237.5 // 3767.5 // 600.0 // 28227.0 3. Write a program that prompts the user for two students' overall scores and that computes their letter grades based on those scores. Assume that scores are in the range of 0 to 100 and that grades are based on the following scale: Score Grade - - - -- = 95 4.0 You should also report whether or not the students passed the course (i.e., whether or not the user got a grade above 0.0) and whether the student may advance to the next course (i.e., whether or not the user got a grade of 2.0 or higher). If the student's grade percent has a decimal, round it to the nearest whole number. Here is a sample log of execution of the program (user input underlined): This program converts two scores into grades. Student 1: What score did you get? 83.7 You received a grade of 2.8 You passed the course You may advance to the next course Student 2: What score did you get? 59.1 You received a grade of 0.0 You failed the course You must take the course again 4. In the following Java program, rewrite the getCoordinates method using factoring to eliminate redundancy. Your method must still produce the same output and result under all cases. import java.util.*; public class Coordinates { public static void main(String[] args) { Scanner console = new Scanner (System.in); double result = get.Coordinates (console); System.out.println(result); public static double getCoordinates Scanner console) { System.out.print("What is the x coordinate? "); double x = console.nextDouble(); int negatives; if (xStep 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