Tuesday, July 20, 2021

Addition of Two Numbers in Pascal

Add Two Numbers in Pascal

 In this article I will show you a simple program to ask the user to give two numbers  and the program will compute the sum of two numbers using Pascal programming language.

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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.









Program Listing

Program Add_Two_Numbers;


Uses Crt;


Var x,y,sum : integer;



Begin

   Clrscr;

   Writeln;

   Write('Add Two Numbers in Pascal');

   Writeln;

   Writeln;

   Write('Enter First Number : ');

   Readln(x);

   Write('Enter First Second : ');

   Readln(y);


   sum := (x+y);


   Writeln;

   Write('The sum of ',x, ' and ' ,y, ' is ', sum , '.');

   Writeln;

   Writeln;

   Write('End of Program');

   Writeln;

   Readln;

End.




Sunday, July 18, 2021

Calculator in Python

Calculator in Python

 

Machine Problem in Python

1. Create a calculator app
2. The user will choose between the 4 math operations (Add, Subtract, Multiply and Divide)
3. The application will ask for 2 numbers
4. Display the result
5. The application will ask again if the user wants to try again
6. Use the appropriate Exception (ex: Invalid input such as text and zero division)






Program Listing

# mod5_act2.py
# Author : Jake R. Pomperada

def calculator():
validMenuOptions = ["+", "-", "*", "/", "e"]
while True:
displayMenu()

menuSelection = input("Enter your Option: ")

# Handling user's menu input
if menuSelection not in validMenuOptions:
print("[-] Error: Invalid Input!")
elif menuSelection == "e":
print("[+] Program Terminated!")
break
else:
# Asking user to enter numbers
try:
firstNumber = float(input("Enter 1st Number: "))
secondNumber = float(input("Enter 2nd Number: "))

result = 0

# Checking each possibility and storing the output in 'result' variable
if menuSelection == "+":
result = firstNumber + secondNumber
print("[+] Answer: ", result)
elif menuSelection == "-":
result = firstNumber - secondNumber
print("[+] Answer: ", result)
elif menuSelection == "*":
result = firstNumber * secondNumber
print("[+] Answer: ", result)
elif menuSelection == "/":
if secondNumber == 0:
print("[-] Error: Cannot divide by zero")
else:
result = firstNumber / secondNumber
print("[+] Answer: ", result)
except:
print("[-] Error: Invalid Input! Only numerical input is allowed.")



def displayMenu():
print("----------------------------")
print(" Menu ")
print("Enter (+) for Addition")
print("Enter (-) for Subtraction")
print("Enter (*) for Multiplication")
print("Enter (/) for Division")
print("Enter (e) to Exit")
print("----------------------------")


if __name__ == "__main__":
calculator()

Instantiation in Python

Instantiation in Python

 
Instantiation

Instantiating a class is creating a copy of the class which  inherits all class variables and methods. Instantiating a  class in Python is simple. To instantiate a class, we simply call the class as if it were a function,  passing the arguments that the __init__ method defines.  The return value will be the newly created object.

Machine Problem in Python

1. Create a Class called Employee
2. Use the init function to collect the employee information
a. Name, email and mobile number
3. Instantiate the Employee class two times with different information
4. Display all the properties of the object.



Program Listing

# mod6_act2.py
# Author : Jake R. Pomperada

class Employee:
def __init__(self, name, email, mobile):
self.pangalan = name
self.email = email
self.contact = mobile


jp = Employee("Jake Pomperada", "jakerpomperada@gmail.com", "09123612561")
mj = Employee("Michael Jordan", "mj23@gmail.com", "09671722123")

print(f"Name: {jp.pangalan} | Email: {jp.email} | Mobile Number: {jp.contact}")
print(f"Name: {mj.pangalan} | Email: {mj.email} | M




Friday, July 16, 2021

Record Keeping App in Python

Record Keeping App in Python

 


Machine Problem in Python


1. Create a Record Keeping App

2. This will display the following options

     a. Add Record

     b. View Records

     c. Clear All Records

     d. Exit

3. If A: The user will input the following information (name,email,address)

4. The app will save the information in a text file.

     If B, display the saved records

     If C, clear the text file and display “No records found.”

     If D, display “Thank you”

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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.





Program Listing

# mod7_act1.py
# Author : Jake R. Pomperada

print("==========================================")
print(" ~ Record Keeping App ~")
print("==========================================")
print("Available Operators:")
print("A) Add Record\t\tB) View Record")
print("C) Clear Records\tD) Exit App\n")
print()
selection = str(input("Select an option [A,B,C,D]: "))

try:
file = open("record.txt", "r")
except FileNotFoundError:
file = open("record.txt", "x")

if selection.upper() == "A":
var1 = str(input("Enter Name: "))
var2 = str(input("Enter Email: "))
var3 = str(input("Enter Address: "))
file = open("record.txt", "a")
file.write(f"\n{var1}, {var2}, {var3}")
file.close()
elif selection.upper() == "B":
file = open("record.txt", "r")
print(file.read())
file.close()
elif selection.upper() == "C":
print("No records found.")
file = open("record.txt", "r+")
file.truncate(0)
file.close()
elif selection.upper() == "D":
print("Thank you")
else:
print("Invalid input.")

Inheritance in Python

Inheritance in Python

 Machine Problem Using Inheritance in Python

1. Create House Class with the following properties and methods

floorSize

noOfFloors

noOfDoors

switchOn()

lightOpen()

ovenOpen()

2. Create TownHouse Class inherit the House class

3. Modify the value of the following(noOfFloors and noOfDoors)

4. Instantiate the TownHouse Class once

5. Display all the properties

Calling the switchOn() will automatically execute lightOpen() and ovenOpen()

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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.






Program Listing

# mod6_act3.py
# Author : Jake R. Pomperada

class House:
def __init__(self, floorSize, noOfFloors, noOfDoors):
self.floorSize = floorSize
self.noOfFloors = noOfFloors
self.noOfDoors = noOfDoors

def switchOn(self):
print()
print("\tSwitch ON")
self.lightOpen()
self.ovenOpen()
print()
print("\tEnd of Program")

def lightOpen(self):
print("\tLight Open")

def ovenOpen(self):
print("\tOven Open")


class TownHouse(House):
def __init__(self, floorSize, noOfFloors, noOfDoors):
super().__init__(floorSize, noOfFloors, noOfDoors)

def displayTownHouseProperties(self):
print()
print("\tHouse Floor Size : ",self.floorSize)
print("\tHouse No. of Floors : ",self.noOfFloors)
print("\tHouse No. of Doors : ",self.noOfDoors)

TownHouse_One = TownHouse(320,3,5)
TownHouse_One.displayTownHouseProperties()
TownHouse_One.switchOn()

Thursday, July 15, 2021

Temperature Converter in Python

Temperature Converter in Python

 Machine Problem in Python

Create a program to convert fahrenheit to celsius and vice versa.

Formula:

(__°C × 9/5) + 32 = __°F

(__°F − 32) × 5/9 = __°C

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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.







Program Listing

# mod1_act1.py
# Author : Jake R. Pomperada

fahrenheit = 120.25
celsius = 37.38

# calculate temperature in Celsius
celsius_to_fahrenheit = (fahrenheit - 32) * 5/9

# calculate temperature in Fahrenheit
fahrenheit_to_celsius = (celsius * 1.8) + 32

print()
print(celsius,u"\N{DEGREE SIGN} celsius is",round(celsius_to_fahrenheit,2),u"\N{DEGREE SIGN} fahrenheit")
print()
print(fahrenheit,u"\N{DEGREE SIGN} fahrenheit is",round(fahrenheit_to_celsius ,2),u"\N{DEGREE SIGN} celsius")

Wednesday, July 14, 2021

Salepersons Salary Commission Solver in Python

 Machine Problem in Python

Write a program code that allows the user to input values for a salesperson' base salary, total sales and  commission rate. The program calculates and displays the  salesperson's pay by adding the base salary  to the product of the total sales and commission rate.

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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.





Program Listing


# mod1_act2.py
# Author : Jake R. Pomperada
# This program calculates salespersons salary.
# Create a variable to control the loop.

retry = "Y"

while retry.upper() == "Y":
# Calculate a series of commissions.
base_salary = float(input('Enter the salespersons base salary: '))
sales = float(input('Enter the amount of total sales: '))
comm_rate = float(input('Enter the commission rate: '))

# Calculate the commission.
commission = sales * (comm_rate /100)
# Calculate the salespersons salary
solve_salary = (base_salary + commission)

# Display the salespersons salary
print()
print( 'Salespersons salary is PHP %.2f' % solve_salary)
# See if the user wants to do another one.
print()
retry = str(input("Would you like to try again? (Y-Yes and N-No) : "))
print()
if retry.upper() == "N":
break
elif retry.upper() == "Y":
continue
print()
print("End of Program")
print()

Tuesday, July 13, 2021

String Replication in Python

String Replication in Python

 A simple program to show how to replicate a string using python programming.

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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.




Program Listing

myString= input("Enter a word:")
print(myString * 5)

print("#" * 43)

Monday, July 12, 2021

Loan Interest Solver in Swing Using Java

 A simple loan interest solver in Swing using Java programming language that I wrote I hope you will find my work useful.

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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.






Program Listing

Loan_Interest_Solver.java

/*

 * To change this license header, choose License Headers in Project Properties.

 * To change this template file, choose Tools | Templates

 * and open the template in the editor.

 */

package com.jakerpomperada.loan_interest_solver;


import javax.swing.*;  

import java.text.DecimalFormat;


/**

 *

 * @author Jacob Samuel

 */

public class Loan_Interest_Solver extends javax.swing.JFrame {


    /**

     * Creates new form Loan_Interest_Solver

     */

    public Loan_Interest_Solver() {

        initComponents();

    }


    /**

     * This method is called from within the constructor to initialize the form.

     * WARNING: Do NOT modify this code. The content of this method is always

     * regenerated by the Form Editor.

     */

    @SuppressWarnings("unchecked")

    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          

    private void initComponents() {


        Jlabel1 = new javax.swing.JLabel();

        principal_amount = new javax.swing.JTextField();

        Jlabel2 = new javax.swing.JLabel();

        percentage_rate = new javax.swing.JTextField();

        Jlabel3 = new javax.swing.JLabel();

        no_of_years = new javax.swing.JTextField();

        Jlabel4 = new javax.swing.JLabel();

        interest_rate = new javax.swing.JTextField();

        solve = new javax.swing.JButton();

        quit = new javax.swing.JButton();

        clear = new javax.swing.JButton();


        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        setTitle("Loan Interest Solver Using Swing in Java");


        Jlabel1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

        Jlabel1.setText("Enter Principal Amount ");


        Jlabel2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

        Jlabel2.setText("Enter Number of Years");


        Jlabel3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

        Jlabel3.setText("Enter Percentage Rate");


        Jlabel4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

        Jlabel4.setText("The Interest Rate");


        solve.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

        solve.setText("Solve");

        solve.setToolTipText("Click here to solve the interest rate.");

        solve.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                solveActionPerformed(evt);

            }

        });


        quit.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

        quit.setText("Quit");

        quit.setToolTipText("Click here to quit program.");

        quit.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                quitActionPerformed(evt);

            }

        });


        clear.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N

        clear.setText("Clear");

        clear.setToolTipText("Click here to clear the textbox.");

        clear.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                clearActionPerformed(evt);

            }

        });


        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

        getContentPane().setLayout(layout);

        layout.setHorizontalGroup(

            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

            .addGroup(layout.createSequentialGroup()

                .addGap(21, 21, 21)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

                    .addGroup(layout.createSequentialGroup()

                        .addComponent(solve, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)

                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 38, Short.MAX_VALUE)

                        .addComponent(clear, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)

                        .addGap(32, 32, 32)

                        .addComponent(quit, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE))

                    .addGroup(layout.createSequentialGroup()

                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

                            .addComponent(Jlabel1)

                            .addComponent(Jlabel2)

                            .addComponent(Jlabel3)

                            .addComponent(Jlabel4))

                        .addGap(18, 18, 18)

                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

                            .addComponent(interest_rate, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)

                            .addComponent(percentage_rate, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)

                            .addComponent(no_of_years, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)

                            .addComponent(principal_amount, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))))

                .addContainerGap())

        );

        layout.setVerticalGroup(

            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

            .addGroup(layout.createSequentialGroup()

                .addGap(31, 31, 31)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                    .addComponent(Jlabel1)

                    .addComponent(principal_amount, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

                .addGap(18, 18, 18)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                    .addComponent(Jlabel2)

                    .addComponent(no_of_years, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

                .addGap(18, 18, 18)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                    .addComponent(Jlabel3)

                    .addComponent(percentage_rate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

                .addGap(28, 28, 28)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                    .addComponent(Jlabel4)

                    .addComponent(interest_rate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 32, Short.MAX_VALUE)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                    .addComponent(solve, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)

                    .addComponent(quit, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)

                    .addComponent(clear, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE))

                .addGap(21, 21, 21))

        );


        pack();

    }// </editor-fold>                        


    private void solveActionPerformed(java.awt.event.ActionEvent evt) {                                      

        // TODO add your handling code here:

         DecimalFormat f = new DecimalFormat("##.00");

        

         if (evt.getSource().equals(solve)) {


           double principal_amt =  Double.parseDouble(principal_amount.getText());

        

           double no_of_yrs =  Double.parseDouble(no_of_years.getText());

           

           double percentage_rate_given = Double.parseDouble(percentage_rate.getText());

           

           double solve_interest = (principal_amt * no_of_yrs * percentage_rate_given) / 100;

          

           interest_rate.setText(String.valueOf(" PHP " + f.format(solve_interest)));

           interest_rate.setEditable(false); 

           

    }             

    }                                     


    private void clearActionPerformed(java.awt.event.ActionEvent evt) {                                      

        // TODO add your handling code here:

         if (evt.getSource().equals(clear)) {

        principal_amount.setText("");

        no_of_years.setText("");

        percentage_rate.setText("");

        interest_rate.setText("");

        principal_amount.requestFocus();

        }

    }                                     


    private void quitActionPerformed(java.awt.event.ActionEvent evt) {                                     

        // TODO add your handling code here:

        if (evt.getSource().equals(quit)) {

                             

   int confirmed = JOptionPane.showConfirmDialog(null, "Exit Program?","Quit Program",JOptionPane.YES_NO_OPTION);

    if(confirmed == JOptionPane.YES_OPTION)

    {

        dispose();

    }

} else {

            

     setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

       }     

    }                                    


    /**

     * @param args the command line arguments

     */

    public static void main(String args[]) {

        /* Set the Nimbus look and feel */

        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 

         */

        try {

            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

                if ("Nimbus".equals(info.getName())) {

                    javax.swing.UIManager.setLookAndFeel(info.getClassName());

                    break;

                }

            }

        } catch (ClassNotFoundException ex) {

            java.util.logging.Logger.getLogger(Loan_Interest_Solver.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        } catch (InstantiationException ex) {

            java.util.logging.Logger.getLogger(Loan_Interest_Solver.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        } catch (IllegalAccessException ex) {

            java.util.logging.Logger.getLogger(Loan_Interest_Solver.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        } catch (javax.swing.UnsupportedLookAndFeelException ex) {

            java.util.logging.Logger.getLogger(Loan_Interest_Solver.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        }

        //</editor-fold>


        /* Create and display the form */

        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {

                new Loan_Interest_Solver().setVisible(true);

            }

        });

    }


    // Variables declaration - do not modify                     

    private javax.swing.JLabel Jlabel1;

    private javax.swing.JLabel Jlabel2;

    private javax.swing.JLabel Jlabel3;

    private javax.swing.JLabel Jlabel4;

    private javax.swing.JButton clear;

    private javax.swing.JTextField interest_rate;

    private javax.swing.JTextField no_of_years;

    private javax.swing.JTextField percentage_rate;

    private javax.swing.JTextField principal_amount;

    private javax.swing.JButton quit;

    private javax.swing.JButton solve;

    // End of variables declaration                   

}



Payroll System Using Swing in Java

 A payroll system that I wrote using Swing in Java programming language I hope you will find it useful.

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 at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.






Program Listing


Payroll_System.java

/*

 * To change this license header, choose License Headers in Project Properties.

 * To change this template file, choose Tools | Templates

 * and open the template in the editor.

 */

package com.jakerpomperada.payroll;


import javax.swing.*;  

import java.text.DecimalFormat;

/**

 *

 * @author Jacob Samuel

 */

public class Payroll_System extends javax.swing.JFrame {


    /**

     * Creates new form Payroll_System

     */

    public Payroll_System() {

        initComponents();

    }


    /**

     * This method is called from within the constructor to initialize the form.

     * WARNING: Do NOT modify this code. The content of this method is always

     * regenerated by the Form Editor.

     */

    @SuppressWarnings("unchecked")

    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          

    private void initComponents() {


        jLabel1 = new javax.swing.JLabel();

        jLabel2 = new javax.swing.JLabel();

        jLabel3 = new javax.swing.JLabel();

        jLabel4 = new javax.swing.JLabel();

        jLabel5 = new javax.swing.JLabel();

        emp_name = new javax.swing.JTextField();

        department = new javax.swing.JTextField();

        id_number = new javax.swing.JTextField();

        gross_salary = new javax.swing.JTextField();

        days_work = new javax.swing.JTextField();

        jLabel6 = new javax.swing.JLabel();

        compute = new javax.swing.JButton();

        clear = new javax.swing.JButton();

        quit = new javax.swing.JButton();

        rate_per_day = new javax.swing.JTextField();

        about = new javax.swing.JButton();


        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        setTitle("Payroll System Using Swing in Java");


        jLabel1.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N

        jLabel1.setText("Employee's Name");


        jLabel2.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N

        jLabel2.setText("Department");


        jLabel3.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N

        jLabel3.setText("Rate Per Day");


        jLabel4.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N

        jLabel4.setText("ID Number");


        jLabel5.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N

        jLabel5.setText("Number of Day's Worked");


        id_number.setToolTipText("");


        jLabel6.setFont(new java.awt.Font("Arial", 1, 12)); // NOI18N

        jLabel6.setText("Gross Salary");


        compute.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N

        compute.setText("Compute");

        compute.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                computeActionPerformed(evt);

            }

        });


        clear.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N

        clear.setText("Clear");

        clear.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                clearActionPerformed(evt);

            }

        });


        quit.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N

        quit.setText("Quit Program");

        quit.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                quitActionPerformed(evt);

            }

        });


        about.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N

        about.setText("About");

        about.setActionCommand("about");

        about.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(java.awt.event.ActionEvent evt) {

                aboutActionPerformed(evt);

            }

        });


        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

        getContentPane().setLayout(layout);

        layout.setHorizontalGroup(

            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

            .addGroup(layout.createSequentialGroup()

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

                    .addGroup(layout.createSequentialGroup()

                        .addContainerGap()

                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

                            .addGroup(layout.createSequentialGroup()

                                .addComponent(jLabel5)

                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

                                .addComponent(days_work, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE))

                            .addGroup(layout.createSequentialGroup()

                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

                                    .addComponent(jLabel1)

                                    .addComponent(jLabel2)

                                    .addComponent(jLabel4)

                                    .addComponent(jLabel3))

                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

                                    .addGroup(layout.createSequentialGroup()

                                        .addGap(52, 52, 52)

                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)

                                            .addComponent(id_number, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)

                                            .addComponent(emp_name, javax.swing.GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE)

                                            .addComponent(department)))

                                    .addGroup(layout.createSequentialGroup()

                                        .addGap(50, 50, 50)

                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

                                            .addComponent(gross_salary, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)

                                            .addComponent(rate_per_day, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)

                                            .addGroup(layout.createSequentialGroup()

                                                .addComponent(clear, javax.swing.GroupLayout.PREFERRED_SIZE, 91, javax.swing.GroupLayout.PREFERRED_SIZE)

                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, Short.MAX_VALUE)

                                                .addComponent(about, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE))))))

                            .addComponent(jLabel6)))

                    .addGroup(layout.createSequentialGroup()

                        .addGap(18, 18, 18)

                        .addComponent(compute)))

                .addGap(27, 27, 27)

                .addComponent(quit)

                .addGap(33, 33, 33))

        );

        layout.setVerticalGroup(

            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

            .addGroup(layout.createSequentialGroup()

                .addGap(21, 21, 21)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                    .addComponent(emp_name, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

                    .addComponent(jLabel1))

                .addGap(18, 18, 18)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                    .addComponent(department, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

                    .addComponent(jLabel2))

                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                    .addComponent(id_number, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

                    .addComponent(jLabel4))

                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED, 21, Short.MAX_VALUE)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                    .addComponent(jLabel5)

                    .addComponent(days_work, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

                .addGap(11, 11, 11)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                    .addComponent(jLabel3)

                    .addComponent(rate_per_day, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

                .addGap(18, 18, 18)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                    .addComponent(jLabel6)

                    .addComponent(gross_salary, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

                .addGap(32, 32, 32)

                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

                    .addComponent(compute)

                    .addComponent(clear)

                    .addComponent(quit)

                    .addComponent(about))

                .addContainerGap(23, Short.MAX_VALUE))

        );


        jLabel1.getAccessibleContext().setAccessibleName("");

        days_work.getAccessibleContext().setAccessibleName("");

        jLabel6.getAccessibleContext().setAccessibleName("");


        pack();

    }// </editor-fold>                        


    private void computeActionPerformed(java.awt.event.ActionEvent evt) {                                        

        // TODO add your handling code here:

       compute.setToolTipText("Click here to compute the gross salary.");

       // TODO add your handling code here:

        DecimalFormat f = new DecimalFormat("##.00");

             if (evt.getSource().equals(compute)) {


           double no_of_days =  Double.parseDouble(days_work.getText());

        

           double rate_days =  Double.parseDouble(rate_per_day.getText());

           

           double gross_pay = (no_of_days * rate_days);

          

           gross_salary.setText(String.valueOf(" PHP " + f.format(gross_pay)));

           gross_salary.setEditable(false); 

           

    }                                       

    }

    private void clearActionPerformed(java.awt.event.ActionEvent evt) {                                      

        // TODO add your handling code here:

        clear.setToolTipText("Click here to clear the text box.");

        if (evt.getSource().equals(clear)) {

        emp_name.setText("");

        department.setText("");

        id_number.setText("");

        days_work.setText("");

        rate_per_day.setText("");

        gross_salary.setText("");

        emp_name.requestFocus();

        }

    }                                     


    private void quitActionPerformed(java.awt.event.ActionEvent evt) {                                     

      if (evt.getSource().equals(quit)) {

        

                     

    int confirmed = JOptionPane.showConfirmDialog(null, "Exit Program?","Quit Program",JOptionPane.YES_NO_OPTION);

    if(confirmed == JOptionPane.YES_OPTION)

    {

        dispose();

    }

} else {

            

     setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

       }        // TODO add your handling code here:

    }                                    


    private void aboutActionPerformed(java.awt.event.ActionEvent evt) {                                      

        // TODO add your handling code here:

        if (evt.getSource().equals(about)) {

        

                     

    int confirmed = JOptionPane.showConfirmDialog(null,"Created By Mr. Jake Rodriguez Pomperada,MAED-IT, MIT","About This Program",JOptionPane.OK_OPTION);

    if(confirmed == JOptionPane.OK_OPTION)

    {

        dispose();

    }

    }                                     

    }

    /**

     * @param args the command line arguments

     */

    public static void main(String args[]) {

        /* Set the Nimbus look and feel */

        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">

        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.

         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 

         */

        try {

            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {

                if ("Nimbus".equals(info.getName())) {

                    javax.swing.UIManager.setLookAndFeel(info.getClassName());

                    break;

                }

            }

        } catch (ClassNotFoundException ex) {

            java.util.logging.Logger.getLogger(Payroll_System.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        } catch (InstantiationException ex) {

            java.util.logging.Logger.getLogger(Payroll_System.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        } catch (IllegalAccessException ex) {

            java.util.logging.Logger.getLogger(Payroll_System.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        } catch (javax.swing.UnsupportedLookAndFeelException ex) {

            java.util.logging.Logger.getLogger(Payroll_System.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);

        }

        //</editor-fold>


        /* Create and display the form */

        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {

                new Payroll_System().setVisible(true);

            }

        });

    }


    // Variables declaration - do not modify                     

    private javax.swing.JButton about;

    private javax.swing.JButton clear;

    private javax.swing.JButton compute;

    private javax.swing.JTextField days_work;

    private javax.swing.JTextField department;

    private javax.swing.JTextField emp_name;

    private javax.swing.JTextField gross_salary;

    private javax.swing.JTextField id_number;

    private javax.swing.JLabel jLabel1;

    private javax.swing.JLabel jLabel2;

    private javax.swing.JLabel jLabel3;

    private javax.swing.JLabel jLabel4;

    private javax.swing.JLabel jLabel5;

    private javax.swing.JLabel jLabel6;

    private javax.swing.JButton quit;

    private javax.swing.JTextField rate_per_day;

    // End of variables declaration                   

}