VB icon

Swing Payroll System

Email
Submitted on: 10/18/2015 1:52:04 PM
By: Jake R. Pomperada  
Level: Beginner
User Rating: Unrated
Compatibility: Java (JDK 1.1), Java (JDK 1.2), Java (JDK 1.3), Java (JDK 1.4), Java (JDK 1.5)
Views: 11522
author picture
 
     A payroll program that I wrote in Java a long time ago that uses swing library for it graphical user interface design that will compute the salary of an employee in the company. If you have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
//**************************************
// Name: Swing Payroll System 
// Description:A payroll program that I wrote in Java a long time ago that uses swing library for it graphical user interface design that will compute the salary of an employee in the company.
If you have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com. My mobile number here in the Philippines is 09173084360.
// By: Jake R. Pomperada
//**************************************

import javax.swing.*;
import java.awt.event.*;
public class payroll extends JFrame implements
ActionListener {
 JTextField emp_name = new JTextField(15);
 JTextField work = new JTextField(15);
 JTextField rate = new JTextField(14);
 JTextField days = new JTextField(15);
 JButton Compute = new JButton("Compute");
 JButton Clear= new JButton("Clear");
JLabel emp_label2 = new JLabel();
JLabel work_label2 = new JLabel();
JLabel salary = new JLabel();
JLabel report = new JLabel();
double solve = 0.00;
public payroll() {
 super("Simple Payroll System");
 setSize(260,280);
 setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 JPanel pane = new JPanel();
 JLabel emp_name_label = new JLabel(" Name ");
 JLabel work_label = new JLabel(" Position ");
 JLabel rate_label = new JLabel(" Rate Per Day ");
 JLabel days_label = new JLabel(" No. of Days ");
 pane.add(emp_name_label);
 pane.add(emp_name);
 pane.add(work_label);
 pane.add(work);
 pane.add(rate_label);
 pane.add(rate);
 pane.add(days_label);
 pane.add(days);
 pane.add(Compute);
 pane.add(Clear);
 Compute.addActionListener(this);
 Clear.addActionListener(this);
 Compute.setToolTipText("Click here to solve the salary.");
 Clear.setToolTipText("Click here to clear text fields.");
 pane.add(report);
 pane.add(emp_label2);
 pane.add(work_label2);
 pane.add(salary);
 add(pane);
 setVisible(true);
}
public void actionPerformed(ActionEvent e)
 {
if(Compute==e.getSource())
{
 String name= emp_name.getText();
 String work2= work.getText();
 double emp_rate=Double.parseDouble(rate.getText());
 int emp_days = Integer.parseInt(days.getText());
 solve = (emp_rate * emp_days);
report.setText(" === Salary Report === ");
emp_label2.setText("Employee's Name : "
+name);
work_label2.setText("Job Description : "
 +work2);
salary.setText("Employee's Salary : $ " +
 String.format("%.2f",solve));
}
else if(Clear==e.getSource())
{
emp_name.setText("");
work.setText("");
rate.setText("");
days.setText("");
report.setText("");
emp_label2.setText("");
work_label2.setText("");
salary.setText("");
 }
 }
public static void main(String[] args)
{
payroll employee = new payroll();
}
}


Other 71 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

5/28/2016 2:51:18 PMProf

I like your Code. It simply demonstrated what payroll is about in short concept.
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.