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...
(Write a program in C++) A local instructor wants you to write a program to calculate...
(Write a program in C++) A local instructor wants you to write a program 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...
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...
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...
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...
Create a program in visual basic that allows the user to manage vehicle information including: •...
Create a program in visual basic that allows the user to manage vehicle information including: • License plate number • Owner name • Owner phone number The user interface will be GUI-based providing the following capabilities: • Add up to 100 vehicles • Remove specified vehicles • View a sorted list of all known license plates • View the data for a specified vehicle • Save the database contents into a file • Load a saved database from a file
Assignment: (Save this file as A7-1.cpp) Write a program to calculate the gross pay for an...
Assignment: (Save this file as A7-1.cpp) Write a program to calculate the gross pay for an assembly line employee that works for a company that pays all assembly line workers $7.50 hour. Any employee that works over 40 hours per week is compensated by being paid time-and-one-half for each hour over 40. a. Use main( ) as the driver function. Allow the user to compute as many employees as desired. b. Write the function getName( ) that prompts for the...
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...
From the following information calculate the price of the stock. The stock will pay its first...
From the following information calculate the price of the stock. The stock will pay its first annual dividend of $1.00 four years from now. The dividends for years 5 and 6 will be $1.20 and $1.30, respectively. After year 6, dividends will grow by 2.00% p.a. forever. The required rate of return is 12.00% p.a. a. $3.50 b. $11.52 c. $9.74 d. $16.49 e. $8.69
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT