Question

I need help with a JAVA program, In the program we need to create the next...

I need help with a JAVA program, In the program we need to create the next method.
Method: End Salary

This method receives the income, the benefits of a employee and a cap. Calculate and return the final income after taxes according to the following:
Case 1: If the sum of income and benefits is greater than or equal to the cap, then 35% of taxes on accrued income will be paid (income + benefits)
Case 2: If the sum of income and benefits is less than the cap, then 20% of taxes on accrued income will be paid 
Also, regardless of whether it is case 1 or case 2: if the benefits are less than half of the income, then it will add to the final income (after taxes) a 5% on that same final income
 The signature of the method is:
Public static double salaryFinal (double salary, double benefits, double top)
 The main () method should print the final income of the
employee.

Thank you very much.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

   public static double salaryFinal (double salary, double benefits, double top){
      
       double accruedIncome = salary+benefits;
       double finalIncome;
       //If the sum of income and benefits is greater than or equal to the cap, then 35% of taxes on accrued income will be paid (income + benefits)
       if(accruedIncome>=top){
           finalIncome = accruedIncome * 0.65;
       }else{ //If the sum of income and benefits is less than the cap, then 20% of taxes on accrued income will be paid
           finalIncome = accruedIncome * 0.80;
       }
      
       //if the benefits are less than half of the income, then it will add to the final income (after taxes) a 5% on that same final income
       if(benefits < salary/2){
           finalIncome = finalIncome * 1.05;
       }
      
       return finalIncome;
   }

OUTCOME:

Add a comment
Know the answer?
Add Answer to:
I need help with a JAVA program, In the program we need to create the next...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • ******** IN JAVA ********* I have a program that I need help debugging. This program should...

    ******** IN JAVA ********* I have a program that I need help debugging. This program should ask a user to input 3 dimensions of a rectangular block (length, width, and height), and then perform a volume and surface area calculation and display the results of both. It should only be done using local variables via methods and should have 4 methods: getInput, volBlock, saBlock, and display (should be void). I have most of it written here: import java.util.*; public class...

  • Hi everyone! I need help on my Java assignment. I need to create a method that...

    Hi everyone! I need help on my Java assignment. I need to create a method that is called sumIt that will sum two values and will return the value.It should also invoke cubeIt from the sum of the two values. I need to change the currecnt program that I have to make it input two values from the console. The method has to be called sumIt and will return to the sum that will produce the cube of the sum...

  • //please help I can’t figure out how to print and can’t get the random numbers to...

    //please help I can’t figure out how to print and can’t get the random numbers to print. Please help, I have the prompt attached. Thanks import java.util.*; public class Test { /** Main method */ public static void main(String[] args) { double[][] matrix = getMatrix(); // Display the sum of each column for (int col = 0; col < matrix[0].length; col++) { System.out.println( "Sum " + col + " is " + sumColumn(matrix, col)); } } /** getMatrix initializes an...

  • I need to create a code for this prompt: In this project we will build a...

    I need to create a code for this prompt: In this project we will build a generic UserInput class for getting keyboard input from the user. Implementation: The class UserInput is a 'Methods only' class, and all the methods should be declared static. Look at the TestScanner.java program at the bottom of this page that inputs a string, int and double. It shows you how to use Scanner class to get input from the keyboard. Write FOUR simple methods, one...

  • Hi I need help with a java program that I need to create a Airline Reservation...

    Hi I need help with a java program that I need to create a Airline Reservation System I already finish it but it doesnt work can someone please help me I would be delighted it doesnt show the available seats when running the program and I need it to run until someone says no for booking a seat and if they want to cancel a seat it should ask the user to cancel a seat or continue booking also it...

  • I need help with this problem in JAVA, i'm doing a various methdos using Scanner. I...

    I need help with this problem in JAVA, i'm doing a various methdos using Scanner. I have to do the next program for the quadratic equation: This method calculates the quadratic equation (both roots) and print both results. Note: this method does not return anything, since it prints theresult by itself. In the main () method, the method must be invoked quadratic with the corresponding parameters. The signature of the quadratic method is: Public static void quadratic (int a, int...

  • Programming 5_1: Create a Java class named <YourName>5_1 In this class create a main method...

    Programming 5_1: Create a Java class named <YourName>5_1 In this class create a main method, but for now leave it empty. Then write a Java method getAverage which takes an array of integers as it’s argument. The method calculate the average of all the elements in the array, and returns that average. The method should work for an array of integers of any length greater than or equal to one. The method signature is shown below: public static double getAverage(...

  • I need java code for the following problem. Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that a...

    I need java code for the following problem. Lab 7: Methods 1. Write a Java program called Numbers that calls the following methods and displays the returned value: Write a method called cubelt that accepts one integer parameter and returns the value raised to the third power as an integer. o Write a method called randominRange that accepts two integer parameters representing a range. The method returns a random integer in the specified range inclusive. 2. o Write a method...

  • I need this java program to contain methods that do some of the work that can...

    I need this java program to contain methods that do some of the work that can be modularized. It must logically be the same as this loop program but instead the logic will be modularized into Java Methods. Continue to take input for every employee in a company, and display their information until a sentinel value is entered, that exits the loop and ends the program. import java.util.Scanner; public class SalaryCalc { double Rpay = 0, Opay = 0; void...

  • need help editing or rewriting java code, I have this program running that creates random numbers...

    need help editing or rewriting java code, I have this program running that creates random numbers and finds min, max, median ect. from a group of numbers,array. I need to use a data class and a constructor to run the code instead of how I have it written right now. this is an example of what i'm being asked for. This is my code: import java.util.Random; import java.util.Scanner; public class RandomArray { // method to find the minimum number in...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT