Monday, July 12, 2021

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                   

}



Friday, July 9, 2021

Simple Room Reservation System in PHP

Simple Room Reservation System in PHP

 A simple room reservation system that I wrote using PHP and MySQL.

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

reservation.sql

-- phpMyAdmin SQL Dump

-- version 5.1.0

-- https://www.phpmyadmin.net/

--

-- Host: 127.0.0.1

-- Generation Time: Jul 07, 2021 at 01:49 PM

-- Server version: 10.4.18-MariaDB

-- PHP Version: 8.0.3


SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";

START TRANSACTION;

SET time_zone = "+00:00";



/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;

/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;

/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;

/*!40101 SET NAMES utf8mb4 */;


--

-- Database: `room_reservation`

--


-- --------------------------------------------------------


--

-- Table structure for table `reservations`

--


CREATE TABLE `reservations` (

  `id` int(11) NOT NULL,

  `name` varchar(100) NOT NULL,

  `room` varchar(100) NOT NULL,

  `date_reserved` varchar(100) NOT NULL

) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;


--

-- Indexes for dumped tables

--


--

-- Indexes for table `reservations`

--

ALTER TABLE `reservations`

  ADD PRIMARY KEY (`id`);


--

-- AUTO_INCREMENT for dumped tables

--


--

-- AUTO_INCREMENT for table `reservations`

--

ALTER TABLE `reservations`

  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;

COMMIT;


/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;

/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;


index.php

<?php
    $local =  "localhost"; // Host Name
    $user  =  "root"; // Host Username
    $pass  =  ""; // Host Password
    $db    =  "room_reservation"; // Database Name

    // Establish connection to the database
    $con = new mysqli($local, $user, $pass, $db);
    // if there is a problem, show error message
    if ($con->connect_errno) {
        echo "Failed to connect to MySQL: " . $con->connect_error;
        exit();
    }

    if(isset($_POST["btnReserve"])) {
        $name = trim($con->real_escape_string($_POST["txtName"]));
        $room = trim($con->real_escape_string($_POST["txtRoom"]));
        $date = trim($con->real_escape_string($_POST["txtDate"]));

        if ($stmt = $con->prepare("INSERT INTO `reservations`(`name`, `room`, `date_reserved`) VALUES (?, ?, ?)")) {
            $stmt->bind_param("sss", $name, $room, $date);
            $stmt->execute();
            $stmt->close();
        } else {
            die('prepare() failed: ' . htmlspecialchars($con->error));
        }
    }
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Simple Room Reservation System in PHP</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css">
    <script src="https://kit.fontawesome.com/c82e9a37b7.js"></script>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/css/bootstrap-datepicker.standalone.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.5.2/css/bootstrap.css">
    <link rel="stylesheet" href="https://cdn.datatables.net/1.10.25/css/dataTables.bootstrap4.min.css">
    <style>
        body {
            background: #e9ecef;
            font-family: sans-serif;
        }
    </style>
</head>
<body class="py-5">
    <main class="container">
        <div class="row">
            <div class="offset-2 col-8 font-size-xl">
                <div class="bg-secondary text-light rounded  text-center p-3">
                    <h2 class="font-weight-bold">Simple Room Reservation System in PHP</h2>
                    <h3>&#187; Jake R. Pomperada, MAED-IT, MIT &#171;</h3>
                </div>
                <form action="" method="post" class="my-5">
                    <div class="form-group">
                        <label for="txtName">Name:</label>
                        <input type="text" class="form-control" name="txtName" required>
                    </div>
                    <div class="form-group">
                        <label for="txtRoom">Room Type:</label>
                        <select class="form-control" name="txtRoom" required>
                            <option value="Regular">Regular</option>
                            <option value="Deluxe">Deluxe</option>
                            <option value="VIP Suite">VIP Suite</option>
                        </select>
                    </div>
                    <div class="form-group">
                        <label for="txtDate">Date:</label>
                        <input type="text" class="form-control datepicker" name="txtDate" id="txtDate" required>
                    </div>
                    <button type="submit" class="btn btn-dark" name="btnReserve">Reserve Now!</button>
                </form>
            </div>
        </div>
        <div class="row mt-5">
            <div class="offset-2 col-8 mt-5">
                <table class="table table-striped table-bordered" id="datatable">
                    <legend class="bg-secondary p-3 text-light text-center rounded">
                        <h2 class="m-0">Reservations Table</h2>
                    </legend>
                    <thead>
                        <th>ID</th>
                        <th>Name</th>
                        <th>Room Type</th>
                        <th>Date</th>
                    </thead>
                    <tbody>
                        <?php                         
                            // Display database table data
                            if ($stmt = $con->prepare("SELECT * FROM `reservations`")) {
                                $stmt->execute();
                                $result = $stmt->get_result();
                                while ($row = $result->fetch_assoc()) {
                                    echo "<tr>".
                                            "<td>".$row["id"]."</td>".
                                            "<td>".$row["name"]."</td>".
                                            "<td>".$row["room"]."</td>".
                                            "<td>".$row["date_reserved"]."</td>".
                                        "</tr>";
                                }
                                $stmt->close();
                            } else {
                                die('prepare() failed: ' . htmlspecialchars($con->error));
                            }
                        ?>
                    </tbody>
                </table>
            </div>
        </div>
    </main>

    <script src="https://code.jquery.com/jquery-3.5.1.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.9.0/js/bootstrap-datepicker.min.js"></script>
    <script src="https://cdn.datatables.net/1.10.25/js/jquery.dataTables.min.js"></script>
    <script src="https://cdn.datatables.net/1.10.25/js/dataTables.bootstrap4.min.js"></script>
    <script>
        $(document).ready(function() {
            $('.datepicker').datepicker({
                autoclose: true,
                todayHighlight: true,
                todayBtn: 'linked',
                startDate: 'today',
            });

            $('#datatable').DataTable();

            $('#txtDate').keypress(function(e) {
                e.preventDefault();
            });
        });
    </script>
</body>
</html>

Wednesday, July 7, 2021

Simple Math Calculator in JavaScript

Simple Math Calculator in JavaScript

 A simple math calculator that I wrote using JavaScript 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

index.htm

<html>

<style>

body {

  background-color:lightgreen;

  font-family:arial;

  font-size:20px;

  font-weight:bold;

  color:blue;

}

p {

  font-family:arial;

  font-size:20px;

  font-weight:bold;

  color: blue;

  }

  

div.text { 

  margin: 0; 

  padding: 0; 

  padding-bottom: 1.25em; 


div.text label { 

  margin: 0; 

  padding: 0; 

  display: block; 

  font-size: 100%; 

  padding-top: .1em; 

  padding-right: 2em; 

  width: 8em; 

  text-align: right; 

  float: left; 


div.text input, 

div.text textarea { 

  margin: 0; 

  padding: 0; 

  display: block; 

  font-size: 100%; 


input:active, 

input:focus, 

input:hover, 

textarea:active, 

textarea:focus, 

textarea:hover { 

  background-color: lightyellow; 

  border-color: yellow; 


</style>  

<body><br>

<h2 align="left"> Simple Math Calculator in JavaScript </h2>

<br>

<div class="text"> 

    <label for="val1">Item Value No. 1</label> 

    <input type="text" size="5" name="val1" id="val1" maxlength="5"/> 

</div> 


<div class="text"> 

    <label for="val2">Item Value No. 2</label> 

    <input type="text" size="5" name="val2" id="val2" maxlength="5"/> 

</div> 

<button onclick="compute()" title="Click here to find the result."> Ok </button> &nbsp;&nbsp;&nbsp;&nbsp;

<button onclick="clear_all()" title="Click here to clear the text fields."> Clear </button>

<br><br><br>

<p id="display1"> </p>

<p id="display2"> </p>

<p id="display3"> </p>

<p id="display4"> </p>


<script>

function compute()

{


var val1 = document.getElementById('val1').value;

var val2 = document.getElementById('val2').value;


var sum = parseInt(val1) + parseInt(val2);

var subtract = parseInt(val1) - parseInt(val2);

var product = parseInt(val1) * parseInt(val2);

var quotient = parseInt(val1) / parseInt(val2);



 document.getElementById("display1").innerHTML = "The sum of " + val1 + " and " + val2 + " is " + sum + ".";

 document.getElementById("display2").innerHTML = "The difference between " + val1 + " and " + val2 + " is " + subtract + ".";

 document.getElementById("display3").innerHTML = "The product between " + val1 + " and " + val2 + " is " + product + ".";

 document.getElementById("display4").innerHTML = "The quotient between " + val1 + " and " + val2 + " is " + quotient + ".";


}


function clear_all()

{

document.getElementById("display1").innerHTML ="";

document.getElementById("display2").innerHTML ="";

document.getElementById("display3").innerHTML ="";

document.getElementById("display4").innerHTML =""; 

document.getElementById("val1").value="";

document.getElementById("val2").value="";

document.getElementById("val1").focus();

}

</script>

</body>

<html>

Tuesday, July 6, 2021

Basic OOP in Python

Basic OOP in Python

 In this tutorial I will show you how to write basic object oriented programming in Python 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

class Dog:
#class attribute
breed = "German Shepherd"
#instance attributes (pangalan,edad)
def __init__(self,name,age): # name and age are called paramaters
self.pangalan = name
self.edad = age
#instance method
def run(self):
return f"{self.pangalan} is running"

#instance objects
preppy = Dog("Preppy",3) #instantation statement
browny = Dog("Browny",8) #instantation statement


#accessing instance attributes

print()
print("\tBasic OOP in Python")
print()
print(f"{preppy.pangalan} is {preppy.edad} years old")
print(f"{browny.pangalan} is {browny.edad} years old")
#accessing class attribute
print(f"Preppy is a {preppy.breed}")
print(f"Browny is also a {browny.breed}")
#accesing instance method using preppy object
print(preppy.run())
#accesing instance method using browny object
print(browny.run())
print()
print("\tEnd of Program")
print()

Crop Images in a Circle Shape Using Photoshop

Sunday, July 4, 2021

Multiplication Table Using For Statement in Python

Multiplication Table Using For Statement in Python

 A simple multiplication table generated using for statement in Python 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

# Multiplication_Table_For.py
# Jake Rodriguez Pomperada, MAED-IT, MIT
# www.jakerpomperada.com and www.jakerpomperada.blogspot.com
# jakerpomperada@gmail.com
# Bacolod City, Negros Occidental

print("-" * 60)
print("\tMULTIPLICATION TABLE USING FOR STATEMENT IN PYTHON")
print("-" * 60)

for a in range(1, 13):
for n in range(1, 13):
print("%4d" % (a * n), end=' ')
print()

print("-" * 60)

Friday, July 2, 2021

Multiplication Table in C#

A simple multiplication table that I wrote using C# 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

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;


namespace Multiplication_Table

{

    class Program

    {

        static void Main(string[] args)

        {

            Console.WriteLine("\n");

            Console.WriteLine("\t\tMultiplication Table in C#");

            for (int i = 1; i <= 12; i++)

            {

                Console.WriteLine("\n");


                for (int j = 1; j <= 12; j++)

                {

                    Console.Write("{0,4}", i * j);

                }


            }


            Console.Read();

        }

    }

}


Multiplication Table in Modern C++

Multiplication Table in Modern C++

 I simple multiplication table that I wrote using Modern C++ approach.

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

// multiplication_table.cpp

// Jake Rodriguez Pomperada, MAED-IT,MIT

// www.jakerpomperada.blogspot.com and www.jakerpomperada.com

// jakerpomperada@gmail.com

// Bacolod City, Negros Occidental Philippines.


#include <iostream>

#include <iomanip>

#include <string>


int main()

{

  const std::string line(60, '-');


  std::cout <<"\n";

  std::cout << line << "\n";

  std::cout << "\t\tMULTIPLICATION TABLE IN MODERN C++" << "\n";

  std::cout << line << "\n";


  for (int a = 1; a < 13; ++a)

  {

    for (int n = 1; n < 13; ++n)

    {

      std::cout << std::setw(4) << a*n << ' ';

    }

    std::cout << "\n";

  }

  std::cout << line << "\n";

}