Machine Problem in Java
Write a simple payroll program that will display the employee's information. The program should perform the following:
* Ask the user to enter the name of the employee
* Prompt the user to select between full time and part time by pressing either F (full time) or P (part-time)
* If F is pressed, ask the user to enter his monthly salary.
Then display his name and salary.
If P is pressed, ask the user to type his rate(pay) per hour, then the number of hour, and then the number of overtime. Then display his or her name and wage. The computation pay is:
hours of overtime x (rate per hour x 125%)
If an invalid letter is pressed, display an error message.
I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.
My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.
Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com
If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.
Your support on my channel is highly appreciated.
Thank you very much.
Program Listing
Employees_Payroll_System.java
import java.text.DecimalFormat;
import java.util.Scanner;
/**
Machine Problem in Java
Write a simple payroll program that will display the employee's
information. The program should perform the following:
Ask the user to enter the name of the employee
Prompt the user to select between full time and part time
by pressing either F (full time) or P (part time)
If F is pressed, ask the user to enter his monthly salary.
Then display his name and salary.
If P is pressed, ask the user to type his rate(pay) per hour, then
the number of hour and then number of overtime. Then display his
or her name and wage. The computation pay is:
hours of overtime x (rate per hour x 125%)
If an invalid letter is pressed, display an error message.
@author Jake Rodriguez Pomperada,MAED-IT, MIT
www.jakerpomperada.com / www.jakerpomperada.blogspot.com
jakerpomperada@gmail.com
Bacolod City, Negros Occidental Philippines
December 4, 2020 Friday 7:52 AM
*/
public class Employees_Payroll_System {
private static DecimalFormat df2 = new DecimalFormat("#.##");
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner input = new Scanner(System.in);
System.out.println("\n");
System.out.print("\tEmployees Payroll System in Java");
System.out.println("\n");
System.out.print("\tEnter Employees Name : ");
String emp_name =input.nextLine();
System.out.print("\tPress F for Full Time or P for Part Time : ");
char job_criteria =input.next().charAt(0);
char select = Character.toUpperCase(job_criteria);
System.out.println();
if (select == 'F') {
System.out.print("\t------ Full Time Employee ----- ");
System.out.println();
System.out.print("\tEnter Basic Pay : ");
double basic_pay = input.nextDouble();
System.out.println("\n");
System.out.println("\t-----------------------------------\n");
System.out.println("\tEmployees Name : " + emp_name );
System.out.println("\tBasic Pay : " + df2.format(basic_pay));
System.out.println();
System.out.print("\t-----------------------------------\n");
System.out.print("\tGross Pay : " + df2.format(basic_pay));
System.out.println("\n");
} else if (select == 'P') {
System.out.print("\t------ Part Time Employee ----- ");
System.out.println("\n");
System.out.print("\tEnter Rate Per Hour : ");
double rate_per_hour = input.nextDouble();
System.out.print("\tEnter No. of Hour(s) Work : ");
double no_hours_work2 = input.nextDouble();
System.out.print("\tEnter No. of Overtime : ");
double no_overtime = input.nextDouble();
double basic_pay2 = (rate_per_hour * no_hours_work2);
double overtime_pay = (no_overtime * rate_per_hour * 1.25);
double gross_pay = (basic_pay2 + overtime_pay);
System.out.println("\n");
System.out.println("\t-----------------------------------");
System.out.println("\tEmployees Name : " + emp_name );
System.out.println("\tBasic Pay : " + df2.format(basic_pay2));
System.out.println("\tOvertime Pay : " + df2.format(overtime_pay));
System.out.print("\t-----------------------------------\n");
System.out.println("\tGross Pay : " + df2.format(gross_pay));
System.out.println("\n");
} else {
System.out.println("\n");
System.out.print("\tInvalid Option. Please Try Again");
}
System.out.print("\tEnd of Program");
System.out.println("\n");
}
}