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

In an effort to downsize and restructure, an employer decides to lay-off or give

ID: 3571789 • Letter: I

Question

In an effort to downsize and restructure, an employer decides to lay-off or give raises to certain employees based on their current salaries and years of service as shown in Table 1. Each employee who is laid off gets severance pay as indicated and their adjusted salary is set to 0 (for simplicity). Each employee who gets a raise does not get severance pay, but has their salary adjusted as shown.  

Write a Java program to calculate the adjusted salary or severance pay for a set of employees, given their initial salaries and years of service. This information should come from the binary data file project10employeeData.dat; there should not be user input. The information in the binary data file contains the employee’s blind number designation (“Employee #”) as UTF, their salary as a double, and their years of service as a double.

Current salary ($USD) Years Severance pay ($USD) Adjustment 0.00 – 30,000.00 0-2 6,000 Laid off (adj. salary is 0) 2+ 15,000 Laid off (adj. salary is 0) 30,000.01 – 60,000.00 0-5 0 2.25% raise   5+ 0 2.0% raise 60,000.01 – 80,000.00 0-5 0 1.75% raise 5+ 0 1.50% raise 80,000.01+ 0-5 0 1.25% raise 5+ 0 1% raise Table 1 - Severance Pay Details for Problem 1
Read in the data from the file and calculate the severance pay and adjusted salary for each employee. Write a new binary data file (project10processedEmployeeData.dat) that contains the following items as described. Each employee record should contain the employee’s: “Employee #” (as UTF, with appropriate number replacing #) initial salary (as double, no currency signs or commas) years of service (as double)
2

severance pay (as double, no currency signs or commas) adjusted salary (as double, no currency signs or commas)

Use appropriate exception handling within the program.

After processing the data, print the following values to the console: total salary value before the restructuring total severance pay total salary value after the restructuring including total severance pay total salary value after the restructuring excluding total severance pay

Notes Complete this assignment using FileInput/OutputStreams and DataInput/OutputStreams

Explanation / Answer

public class TaxCalculator {

    int pan;

    String name;

    double taxableincome;

    double tax;

    void input() throws IOException {

        InputStreamReader in = new InputStreamReader(System.in);

        BufferedReader br = new BufferedReader(in);

        System.out.println("Enter name and taxable income:");

        name = br.readLine();

        taxableincome = Double.parseDouble(br.readLine());

    }

    void computeData() {

        if (taxableincome <= 60000) {

            tax = 0;

        } else if (taxableincome > 60000 && taxableincome <= 150000) {

            tax = taxableincome * 0.05;

        } else if (taxableincome > 150000 && taxableincome <= 500000) {

            tax = taxableincome * 0.1;

        } else {

            tax = taxableincome * 0.2;

        }

    }

    void displayData() {

        System.out.println(

        "Display Data”);

        System.out.println("Name=" + name);

        System.out.println("Taxable Income=" + taxableincome);

        System.out.println("Tax Paid=" + tax);

    }

    public static void main(String args[]) throws IOException {

        TaxCalculator ob = new TaxCalculator();

        ob.input();

        ob.computeData();

        ob.displayData();

    }

}


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