Question

In: Computer Science

Develop a Java program that determines the gross pay for an employee. The company pays hourly...

Develop a Java program that determines the gross pay for an employee. The company pays hourly rate for the first 40 hours worked by the employee and time and a half (1.5x hourly rate) for all hours worked in excess of 40. The user of your application will enter an employee name, shift (day or night) ,the number of hours worked for the week and their hourly rate. Your program should then calculate and display the employee’s name, regular pay, overtime pay, total gross pay and payperiod. PayPeriod is "Friday" for "day" shift and "Saturday" for "night" shift. Use class Scanner to input the data. Be sure to format output, so it is professionally displayed to your users.

Here is an example of pseudocode:


Start
Enter employee name
Enter employee shift (day/night)
Enter hours worked
Enter hourly pay rate
Calculate reg pay
if hours worked > 40 then
Calculate overtime pay
else
overtime = 0
Calculate total pay
Output employee name, reguldar pay, overtime pay, total pay
If day shift
output “Friday payperiod”
Else
output “Saturday payperiod”.
End.

Solutions

Expert Solution


package javaapplication1;

import java.util.Scanner;

/**
*
* @
*/
public class JavaApplication1 {
double Rpay=0, Opay=0;
void calPay(double hours, double rate){
if(hours<=40){
Rpay = hours * rate;
Opay = 0;
}
else {
double Rhr,Ohr;
Rhr = 40;
Ohr = hours-Rhr;
Rpay = Rhr * rate;
Opay = Ohr * (1.5*rate);
}
  
}
  
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String name;
int shift;
Double rate, hours;
  
System.out.println("Hello Welcome To PAY CALCULATOR");
System.out.println("Please Enter Your Name");
name=sc.next();
System.out.println("Please Enter Your Shift, Please Enter 0 for Day, 1 for Night");
System.out.println("0=Day, 1= Night");
shift=sc.nextInt();
System.out.println("Please Enter Number of Hours You Have Worked");
hours=sc.nextDouble();
System.out.println("Please Enter Your Hourly Pay Rate");
rate=sc.nextDouble();
  
JavaApplication1 c= new JavaApplication1();
c.calPay(hours,rate);

Double Tpay= c.Rpay+ c.Opay;
  
System.out.println();
System.out.println("Calculating Pay");
System.out.println("Employee Name: "+name);
System.out.println("Employee Regular Pay: "+c.Rpay);
System.out.println("Employee Overtime Pay: "+c.Opay);
System.out.println("Employee Total Pay: "+Tpay);
if(shift==0){
System.out.println("Employee PayPeriod is Friday");
}
else{
System.out.println("Employee PayPeriod is Saturday");
}
}
  
}

Thanks and regards
if you like the answer please give a thumbs up
if you have a problem, feel free to comment.


Related Solutions

Develop a Java application that determines the gross pay for each of three employees.
(Salary Calculator) Develop a Java application that determines the gross pay for each of three employees. The company pays straight time for the first 40 hours worked by each employee and time and a half for all hours worked in excess of 40. You’re given a list of the employees, their number of hours worked last week and their hourly rates. Your program should input this information for each employee, then determine and display the employee’s gross pay. Use class...
Develop a C++ program that will determine the gross pay and net pay (after taxes). Each...
Develop a C++ program that will determine the gross pay and net pay (after taxes). Each employee pays a flat tax of 150.00 on the first 1000.00 dollars earned. If the employee earns less than 1000.00 dollars then he/she pays no taxes. Taxes are computed at 15.5% on all earnings over 1000.00 dollars if the number of dependents is 3 or less and 12.5% if the number of dependents are 4 or more. Sample input/outpt dialog Enter # of yours...
Develop a C++ program that will determine the gross pay and netpay (after taxes). Each...
Develop a C++ program that will determine the gross pay and net pay (after taxes). Each employee pays a flat tax of 150.00 on the first 1000.00 dollars earned. If the employee earns less than 1000.00 dollars then he/she pays no taxes. Taxes are computed at 15.5% on all earnings over 1000.00 dollars if the number of dependents is 3 or less and 12.5% if the number of dependents are 4 or more.
Write a program that calculates pay for either hourly paid workers or salaried workers. Hourly paid...
Write a program that calculates pay for either hourly paid workers or salaried workers. Hourly paid workers are paid their hourly pay rate times the number of hours worked. Salaried workers are payed their regular salary plus any bonus they may have earned. The program should declare two structures for the following data: • Hourly Paid ◦HoursWorked ◦ HourlyRate • Salaried ◦ Salary ◦ Bonus The program should also declare a structure with two members. Each member should be a...
Write a program in JAVA that takes in two words, and then it recursively determines if...
Write a program in JAVA that takes in two words, and then it recursively determines if the letters of the first word are contained, in any order, in the second word. If the size of the first word is larger than the second then it should automatically return false. Also if both strings are empty then return true. YOU MAY NOT(!!!!!!!!!!): Use any iterative loops. In other words, no for-loops, no while-loops, no do-while-loops, no for-each loops. Use the string...
In C++, Write a program that calculates pay for either an hourly paid worker or a...
In C++, Write a program that calculates pay for either an hourly paid worker or a salaried worker. Hourly paid workers are paid their hourly pay rate times the number of hours worked. Salaried workers are paid their regular salary plus any bonus they may have earned. The program should declare two structures for the following data: Hourly Paid: HoursWorked HourlyRate Salaried: Salary Bonus The program should also declare a union with two members. Each member should be a structure...
Pay Packages Explained Executive pay packages differ substantially from typical salaried or hourly employee compensation because...
Pay Packages Explained Executive pay packages differ substantially from typical salaried or hourly employee compensation because unlike typical employee pay, the vast majority of an executive's pay is contingent compensation and structured only to reward the executive for actual, positive company performance and growth in shareholder value. To this end, executive compensation packages typically utilize six distinct compensation components: Base Salary Short-Term Incentive Long-Term Incentive Employee Benefits Perquisites Severance/Change-in-Control Payments A company's Compensation Committee will structure their executive's pay packages...
develop an algorithm and then a C program that accomplishes the following. determines the minimum number...
develop an algorithm and then a C program that accomplishes the following. determines the minimum number of quarters, dimes, nickels, and pennies to make change for any amount of cents from 1 cent to 99 cents inclusive; produces an error message if 0 or more than 99 is entered as input, but the program will keep running and ask for another input; terminate if 0 or a negative number is entered. Here is possible example of the program running (remember...
develop an algorithm and then a C program that accomplishes the following. determines the minimum number...
develop an algorithm and then a C program that accomplishes the following. determines the minimum number of quarters, dimes, nickels, and pennies to make change for any amount of cents from 1 cent to 99 cents inclusive; produces an error message if 0 or more than 99 is entered as input, but the program will keep running and ask for another input; terminate if 0 or a negative number is entered. Here is possible example of the program running (remember...
I am trying to write a java program that determines if an inputted year is a...
I am trying to write a java program that determines if an inputted year is a leap year or not, but I am not able to use if else statements how would I do it. I don't need the code just advice.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT