Thursday, March 24, 2022

Full Time and Part Time Employee's Payroll System Using Java Version 1.0

 Machine Problem


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 in 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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg


=================================================

Want to support my the channel?


GCash Account


Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.






Program Listing

RunEmployee.java

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

public class RunEmployee
{
    private static DecimalFormat df2 = new DecimalFormat("#.00");

    public static void main(String[] args) 
    {
        Scanner input = new Scanner(System.in);
        System.out.println();
        System.out.print("\tEnter 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();
            FullTimeEmployee emp = new FullTimeEmployee();
            emp.setName(emp_name);
            emp.setMonthlySalary(basic_pay);
            System.out.println("\n");
            System.out.println("\tName    :  " + emp.getName());
            System.out.println("\tWage    :  " + df2.format(emp.getMonthlySalary()));

            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  and No. of Hours Worked  Seperated By Space     :  ");
            double rate_per_hour = input.nextDouble();
            int no_hours_work2 = input.nextInt();

            PartTimeEmployee emp = new PartTimeEmployee();
            emp.setName(emp_name);
            emp.setRatePerHour(rate_per_hour);
            emp.setHoursWorked(no_hours_work2);
            System.out.println("\tName    :  " + emp.getName());
            System.out.println("\tWage    :  " + df2.format(emp.getWage()));

            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");
        input.close();

    }
}


Employee.java

class Employee
{
    private String name;

    public void setName(String name)
    {
        this.name = name;
    }

    public String getName()
    {
        return name;
    }
}


PartTimeEmployee.java



class PartTimeEmployee extends Employee
{
    private double ratePerHour;
    private int hoursWorked;
    private double wage;

    public void setWage()
    {
        wage = hoursWorked * ratePerHour;
    }

    public double getWage()
    {
        setWage();
        return wage;
    }

    public void setRatePerHour(double rate)
    {
        ratePerHour = rate;
    }

    public void setHoursWorked(int hours)
    {
        hoursWorked = hours;
    }
}


FullTimeEmployee.java

class FullTimeEmployee extends Employee { private double monthlySalary; public void setMonthlySalary(double salary) { monthlySalary = salary; } public double getMonthlySalary() { return monthlySalary; } }


No comments:

Post a Comment