Question

In: Computer Science

A company wants a program that will calculate the basic pay information for all of their...

A company wants a program that will calculate the basic pay information for all of their employees. The following requirements are necessary to make the program work as it needs to:

This program must allow the user to input whether he or she is hourly or salaried.

If salaried, the employee should be prompted to enter a weekly salary.

If hourly, the employee should be prompted to enter an hourly wage and the number of hours worked, so that the program can calculate their weekly pay, including overtime if it is appropriate.

The following taxes must be deducted from gross pay regardless of salary or hourly choice:

State tax of 6%

Federal tax of 15%

Social Security tax of 6.2%

Medicare tax of 1.45%

Output the following in an easily readable format:

Salary or Hourly choice

Either Salary or Hours Worked and Hourly Wage

Total Gross Pay

Each Tax Amount

Net Pay

Your project manager wants a flowchart of your process and detailed comments of your code so that your program is easy to understand for other programmers

Solutions

Expert Solution

/**The java program that prompts user to ener type of employee
* hourly or salaried.
* Prompt wage and number of hours for hourly employee.
* Prompt weekly salary for salaried employee.
* Print state, federal, seccurity and medicare tax
* for the corresponding selected employee
* */
import java.util.Scanner;
public class EmployeePay
{
   public static void main(String[] args)
   {  
       //create scanner class object
       Scanner scanner=new Scanner(System.in);
       //constants variables for taxes
       final double STATE_TAX=0.06; // 6%
       final double FEDERAL_TAX=0.15;//15%
       final double SOCAIL_SECURITY_TAX=0.062;//6.2%
       final double MEDICARE_TAX=0.0145;//1.42%
      
      
       //set variables to zero
       double payRate=0;
       int numHours=0;
       double totalSalary=0;
      
       System.out.println("\t1.Hourly Pay");
       System.out.println("\t2.Salaried Pay");
       System.out.println("Enter your choice : ");
       //read user choice
       int choice=scanner.nextInt();
      
       if(choice==1)
       {
           System.out.println("Enter hourly wage");
           //read hourly wage
           payRate=scanner.nextDouble();
           System.out.println("Enter number of hours workd");
           //read number of hours
           numHours=scanner.nextInt();
           //calculate total salary
           totalSalary=payRate*numHours;
           //print gross pay
           System.out.printf("Gross Pay : %.2f\n",totalSalary);
           System.out.printf("Hourly Employee\n");
       }
       else if(choice==2)
       {
           System.out.println("Enter weekly pay");
           double weeklySalary=scanner.nextDouble();
           //read weekly salary
           totalSalary=weeklySalary;
           //print gross pay of weekly salary
           System.out.printf("Gross Pay : %.2f\n",totalSalary);          
           System.out.println("Weekly Employee");
       }
              
      
      
       //calculate state tax
       double stateTax=totalSalary*STATE_TAX;
       System.out.printf("State Tax :%.2f\n",stateTax);
      
       totalSalary=totalSalary-stateTax;
      
       //calculate federal tax
       double federalTax=totalSalary*FEDERAL_TAX;
       System.out.printf("Federal Tax :%.2f\n",federalTax);
      
       totalSalary=totalSalary-federalTax;
      
      
       //calculate security tax
       double securityTax=totalSalary*SOCAIL_SECURITY_TAX;
       System.out.printf("Social Security Tax :%.2f\n",securityTax);
      
       totalSalary=totalSalary-securityTax;
      
       //calculate medical tax
       double medicareTax=totalSalary*MEDICARE_TAX;
       System.out.printf("Medicare Tax :%.2f\n",federalTax);          
       totalSalary=totalSalary-medicareTax;
                  
       double netPay=totalSalary;
       //print net salary
       System.out.printf("Net Pay :%.2f\n",netPay);      
   }
}

---------------------------------------

Sample output:

sample run1:

1.Hourly Pay
2.Salaried Pay
Enter your choice :
2
Enter weekly pay
5000
Gross Pay : 5000.00
Weekly Employee
State Tax :300.00
Federal Tax :705.00
Social Security Tax :247.69
Medicare Tax :705.00
Net Pay :3692.97


sampel run2:

    1.Hourly Pay
   2.Salaried Pay
Enter your choice :
1
Enter hourly wage
40
Enter number of hours workd
100
Gross Pay : 4000.00
Hourly Employee
State Tax :240.00
Federal Tax :564.00
Social Security Tax :198.15
Medicare Tax :564.00
Net Pay :2954.38


Related Solutions

Write a program to help a small company calculate the amount of money to pay its...
Write a program to help a small company calculate the amount of money to pay its employees. In this simplistic world, the company has exactly three employees. However, the number of hours per employee may vary. The company will apply the same tax rate to every employee The program must be written in Java. Prompt the user for the inputs and store the values in variables Must include all the inputs and outputs listed here and perform the calculations correctly...
C++ program: ABC Co wants you to develop a C++ program to calculate the total invoice...
C++ program: ABC Co wants you to develop a C++ program to calculate the total invoice based on the user inputs item price and the quantity of the item purchased, taking into consideration the discount given for each category as follow: Less than 10 Item: No discount Between 10 and 20 items: 10 % off the item price More than 20 items: 20% off the item price. Your Program should display, the total before discount, how much discount and the...
1. Determine the Basic and Diluted Earnings Per Share for Company X. All necessary Information is...
1. Determine the Basic and Diluted Earnings Per Share for Company X. All necessary Information is listed below. Show your calculations. 2. In 100 words, or fewer, explain why investors should be more interested in the the Diluted EPS number than the Basic EPS number. Company X information for Diluted Shares calculations for period 201X: Earnings for Year 201X - $20 million Average Basic shares outstanding for Company X in 201X – 10 million Average Stock Price for year 201X...
Using C++ Write a program to calculate the amount a customer should pay in a checkout...
Using C++ Write a program to calculate the amount a customer should pay in a checkout counter for the purchases in a bagel shop. The products sold are bagels, cream cheese, and coffee. Use the pseudo code discussed in the class to write the program. Make reasonable assumptions about the prices of bagel, cream cheese, and coffee. Declare prices of bagel, cream cheese, and coffee as constants.
An amateur meteorologist keeps a list of daily temperatures and wants a program to calculate how...
An amateur meteorologist keeps a list of daily temperatures and wants a program to calculate how many times the maximum temperature occurred. For example, if the list of temperatures is [21, 24, 24, 23, 20, 19, 21, 24], the maximum of 24 occurs 3 times. a.Consider the problem of calculating how many times the maximum temperature occurs. i.What are the admissible inputs of the problem? ii.What is the output of this problem? b.Write three tests for this problem. The inputs...
A local instructor wants you to write a c++ program using arrays to calculate the average...
A local instructor wants you to write a c++ program using arrays to calculate the average score made on exams by her students. For simplicity, she always has only 12 students in each course she teaches. She teaches multiple subjects so she would like to enter the name of the exam. She wants the program to also determine the highest and lowest scores and the number of students who passed and failed the exam. A score of 60 or above...
Fill in the following table, supplying all the missing information. Use this information to calculate the...
Fill in the following table, supplying all the missing information. Use this information to calculate the security’s beta. (Negative values should be indicated by a minus sign. Leave no cells blank - be certain to enter "0" wherever required. Do not round intermediate calculations. Enter your Return Deviations answers as a whole number percentage. Round Squared Deviations, Product of Deviations answers to 5 decimal places and Security's beta answer to 2 decimal places. Omit the "%" sign in your response.)...
Write Visual Basic program that seperates all natural numbers up to 863 value with a comma...
Write Visual Basic program that seperates all natural numbers up to 863 value with a comma side by side and show on the screen Please write readable.Thankss
This is all of the information the professor provided. It is very vague. She just wants...
This is all of the information the professor provided. It is very vague. She just wants us to list examples of possible variables then make aup a hypothesis to show that we have an understanding of the terms. Experiment 1 - Clorox Vs. Lysol Questions: Independent Variable: Dependent variable: Name two good control variables: Positive Control Experiment: Hypothesis: Experiment 2 - Turtoring and Test Taking Questions: Independent Variable: Dependent variable: Name two good control variables: Negative Control Experiment: Hypothesis: Experiment...
Calculate gross pay for each of the following employees. All are paid an overtime wage rate...
Calculate gross pay for each of the following employees. All are paid an overtime wage rate that is 1.5 times their respective regular wage rates. NOTE: For simplicity, all calculations throughout this exercise, both intermediate and final, should be rounded to two decimal places at each calculation. 1:Anita Workman receives tips from customers as a standard component of her weekly pay. She is paid $2.60/hour by her employer and receives $291 in tips during the most recent 44-hour workweek. Gross...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT