Question

In: Computer Science

For this assignment, you will take on the role of software developer as part of a...

For this assignment, you will take on the role of software developer as part of a team of developers for a retail company. The payroll manager of the company has tasked you with developing a Java program (if you can put it in NetBeans that would be awesome) to quickly calculate an employee’s weekly gross and net pay. The program must prompt the user to enter the employee’s name, rate of pay, and hours worked. The output will display the information entered into the program along with the calculations for gross pay, total amount of deductions, and net pay.

In this coding assignment, you will utilize the Java syntax and techniques you learned while reviewing the required resources for Week 1. You may select appropriate variable names as long as proper Java syntax is used. You will also submit your source code.

Input:
In the input section, utilize Java syntax and techniques to input the employee’s name, rate of pay, and hours worked. The input should be completed either via keyboard or via file.

Processing:
In the processing section, the following calculations will need to be performed in the processing section:

  • Gross Pay:
    Gross pay if hours worked are 40 hours or less = hours worked * rate of pay
    Gross pay if hours worked are greater than 40 hours = ((hours worked – 40) * (rate of pay * 1.5)) + (40 * rate of pay)
    • Example – Employee worked 55 hours. The employee’s rate of pay is $10.00.
      ((55 – 40) * (10 * 1.5)) + (40 * 10) = 625
      The gross pay is $625.
  • Deductions:
    Deductions are calculated based upon the following rates:
    • Federal Tax = 15%
    • State Tax = 3.07%
    • Medicare = 1.45%
    • Social Security = 6.2%
    • Unemployment Insurance = .07%

The following calculations are used to calculate each deduction:

  • Federal tax amount = federal tax rate* gross pay
  • State Tax amount = state tax rate * gross pay
  • Medicare amount = Medicare rate * gross pay
  • Social Security amount = social security rate * gross pay
  • Unemployment Insurance amount = unemployment insurance amount * gross pay

Total deductions = Federal Tax amount + State Tax amount + Medicare amount + Social Security amount + Unemployment Insurance amount

  • Net Pay:
    The net pay amount is calculated as follows:
    Net pay = gross pay amount – total deductions

Output:
The Java program should display the following information:

  • Employee Name
  • Rate of Pay
  • Hours Worked
  • Overtime Worked
  • Gross Pay
  • Total amount of deductions
  • Net Pay

Solutions

Expert Solution

Hi,

Please find below code as per your requirement.

Let me know if you have any doubt/concerns in this via comments.

Hope this answer helps you.

Thanks.

/**********************JAVA CODE*********************/

/***************EmployeePay.java***************/

import java.text.DecimalFormat;
import java.util.Scanner;

public class EmployeePay {

        public static void main(String[] args) {
                //Scanner class is used to get user input using console i.e. System.in
                Scanner sc = new Scanner(System.in);
                
                //Decimal Format is used to format all amount upto 2 decimal places
                DecimalFormat df = new DecimalFormat("#.##");

                System.out.print("Please enter Employee Name: ");
                //reading user input for employee name into employeeName variable
                String employeeName = sc.nextLine();

                System.out.print("Please enter Rate of Pay: ");
                //reading user input for Rate of Pay into rateOfPay variable
                double rateOfPay = Double.parseDouble(sc.nextLine());

                System.out.print("Please enter Total Hours worked: ");
                //reading user input for Total Hours worked into totalHoursWorked variable
                int totalHoursWorked = Integer.parseInt(sc.nextLine());

                //initializing variables for gross pay and overtime
                double grossPay = 0;
                int overtime = 0; 

                //if total hours worked is greater that 40 hours
                if(totalHoursWorked > 40) {
                        overtime = totalHoursWorked - 40;
                        grossPay = ((totalHoursWorked - 40) * (rateOfPay * 1.5)) + (40 * rateOfPay);
                } else { //if total hours less than equal to 40 hours
                        grossPay = totalHoursWorked * rateOfPay;
                }
                
                //initializing variables and calculating all deductions
                double deductions = 0;
                double federalTax = ((grossPay * 15)/100);
                double stateTax = ((grossPay * 3.07)/100);
                double medicare = ((grossPay * 1.45)/100);
                double socialSecurity = ((grossPay * 6.2)/100);
                double unemploymentInsurance = ((grossPay * 0.07)/100);
                
                //summing up all the deductions
                deductions = federalTax + stateTax + medicare + socialSecurity + unemploymentInsurance;
                
                //calculating net pay
                double netPay = grossPay - deductions;
                
                //Printing all details of Pay also used DecimalFormatter to format amount
                System.out.println("Employee Name: "+employeeName);
                System.out.println("Rate of Pay: $"+rateOfPay);
                System.out.println("Hours worked: "+totalHoursWorked);
                System.out.println("Overtime worked: "+overtime);
                System.out.println("Gross Pay: $"+df.format(grossPay));
                System.out.println("Total Amount deductions: $"+df.format(deductions));
                System.out.println("Net Pay: $"+df.format(netPay));
                
                
        }
}

/*****************Code output sample screenshot***************/


Related Solutions

Overview In this assignment, you will take on the role of a senior member of the...
Overview In this assignment, you will take on the role of a senior member of the finance team assigned to lead the investment committee of a medium-sized telecommunications equipment manufacturer. Your team is evaluating a “make-versus-buy” decision that has the potential to improve the company’s competitiveness, but which requires a significant capital investment in new equipment. The assignment is organized into two parts: Part A: Data calculations based on the information in the scenarios Part B: Recommendations based on the...
Choice 1. You are the new software developer at work. You are brought into a meeting...
Choice 1. You are the new software developer at work. You are brought into a meeting with clients that do not understand the idea of sorting data. Now you know, that you cannot use complex math to explain, but you can illustrate in diagrams. Basically, this group has been working with unsorted data and you must explain why their searches and reports will be so much faster with sorted data. You do not know anything specific about their data, but...
You are working as the software developer and need to identify the best sorting algorithm. You...
You are working as the software developer and need to identify the best sorting algorithm. You can pick any two-sorting algorithm. You need to determine which sorting algorithm is the best to sort the array of 10k elements. Use the following steps to help with your solution: Create C++ functions for any two-sorting algorithm. Write down the random array generation function to generate at least 10k elements. Pass the same array into both the sorting algorithm. Calculate the end transactiontime-start...
You are working as a software developer for a large insurancecompany. Your company is planning...
You are working as a software developer for a large insurance company. Your company is planning to migrate the existing systems from Visual Basic to Java and this will require new calculations. You will be creating a program that calculates the insurance payment category based on the BMI score.Your Java program should perform the following things:Take the input from the user about the patient name, weight, birthdate, and height.Calculate Body Mass Index.Display person name and BMI Category.If the BMI Score...
Analyzing Unearned Revenue Changes Take-Two Interactive Software, Inc. (TTWO) is a developer, marketer, publisher, and distributor...
Analyzing Unearned Revenue Changes Take-Two Interactive Software, Inc. (TTWO) is a developer, marketer, publisher, and distributor of video game software and content to be played on a variety of platforms. There is an increasing demand for the ability to play these games in an online environment, and TTWO has developed this capability in many of its products. In addition, TTWO maintains servers (or arranges for servers) for the online activities of its customers. TTWO considers that its products have multiple...
Analyzing Unearned Revenue Changes Take-Two Interactive Software, Inc. (TTWO) is a developer, marketer, publisher, and distributor...
Analyzing Unearned Revenue Changes Take-Two Interactive Software, Inc. (TTWO) is a developer, marketer, publisher, and distributor of video game software and content to be played on a variety of platforms. There is an increasing demand for the ability to play these games in an online environment, and TTWO has developed this capability in many of its products. In addition, TTWO maintains servers (or arranges for servers) for the online activities of its customers. TTWO considers that its products have multiple...
You are a renowned software developer and you have been hired by an old British boyband...
You are a renowned software developer and you have been hired by an old British boyband that wants to make a comeback in the industry. They ask you to make an app to showcase their new music and events. In your implementation, you have a class for each of the 5 group members, but you find that compiling each band member’s class takes more time than you currently have. Luckily, you remember that you learned about Makefiles in your favorite...
You are working as a software developer for a large insurance company. Your company is planning...
You are working as a software developer for a large insurance company. Your company is planning to migrate the existing systems from Visual Basic to Java and this will require new calculations. You will be creating a program that calculates the insurance payment category based on the BMI score. Your Java program should perform the following things: Take the input from the user about the patient name, weight, birthdate, and height. Calculate Body Mass Index. Display person name and BMI...
RUN THIS PROGRAM ON NETBEANS As a Software Developer, you have received a requirement from a...
RUN THIS PROGRAM ON NETBEANS As a Software Developer, you have received a requirement from a Company to implement a prototype for its payroll system. You receive the following specifications: If an employee works more than its regular hours, it is considered overtime and it will be paid based on the employee’s experience. All employees are paid biweekly (80 hours) Employee taxes: 1% This company manages three categories of workers based on employee’s experience. Group 1 (Silver) o Pay rate:...
Role of Software and technology in enterprise management and accounting.. the assignment should include the following:...
Role of Software and technology in enterprise management and accounting.. the assignment should include the following: a. Title b. Broad problem definition c. Problem statement: Objectives and specific questions d. Scope of the study e. Importance of the study
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT