Wednesday, July 12, 2017

Lending Program in C++

A very simple program that I wrote 7 years ago to compute the interest rate of the money being loan by the customer in a lending company I wrote this program using C++.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.


Program Listing

#include <iostream>
#include <iomanip>
#include <fstream>


using namespace std;

main() {

    string name;

    int principal=0;
    int number_months=0;
    float rate=0.00,solve_rate=0.00;

    ofstream file("report.txt");

    cout << "\t  Kwarta Agad Lending Investor";
    cout << "\n\n";
    cout << "Enter Customer Name    :=> ";
    getline(cin,name);
    cout << "\nEnter Amount  Loan   :=> ";
    cin >> principal;
    cout << "\nNumber of Months    :=> ";
    cin >> number_months;
    cout << "\nEnter Rate Per Month :=> ";
    cin >> rate;
    solve_rate = (principal * number_months * rate ) ;
    cout << "\n\n";
    cout << fixed << setprecision(2);
    cout << "The Simple Interest Rate is Php "
         << solve_rate << ".";

    file << "\n\t ======= Kwarta Agad Lending Investor =========";
    file << "\n\n";
    file << "\n\t\t CUSTOMER REPORT";
    file << "\n\n";
    file << "\n Customer Name     : " << name;
    file << "\n Amount   Loan     : " << principal;
    file << "\n Number of Months  : " << number_months;
    file << "\n Rate Per Month    : " << rate;
    file << "\n\n";
    file << fixed << setprecision(2);
    file << "\n Interest Rate is Php " << solve_rate;
    file.close();
    cout << "\n\n";
    system("pause");
}

Histogram in C++

A very simple program in C++ to generate a Histogram and save on the text file.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.


Program Listing

#include <iostream>
#include <fstream>


using namespace std;

 main()
    {

       ofstream file("data.txt");

       cout<<"\n I)- First Histogram :"<<endl;

       for(int count_1=1;count_1<=10;count_1++)
 {
    for(int count_2=1;count_2<=count_1;count_2++)
cout<<"*";
       cout << "\n";
 }

       cout<<"\n II)- Second Histogram :"<<endl;

       for(int count_3=1;count_3<=10;count_3++)
 {
    for(int count_4=10;count_4>=count_3;count_4--)
cout<<"*";
     cout << "\n";
 }
 file << "\n\n";
 file   <<"\n I)- First Histogram :"<<endl;

       for(int count_1=1;count_1<=10;count_1++)
 {
    for(int count_2=1;count_2<=count_1;count_2++)
file<<"*";
        file << "\n";
 }

       file <<"\n II)- Second Histogram :"<<endl;

       for(int count_3=1;count_3<=10;count_3++)
 {
    for(int count_4=10;count_4>=count_3;count_4--)
file <<"*";
     file << "\n";
 }
 file.close();

    cout << "\n\n";
    system("pause");
    }

Odd and Even Numbers in Java Using Methods

In this sample program it will ask the user to give a number and then our program written in Java will check if the given number is an odd or even numbers using methods in Java.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Sample Program Output



Program Listing

// Problem : Write a program in Java that will check if the given number by the user is an
//           Odd or Even Number.         
// Date:  June 28, 2015
// Written By: Mr. Jake R. Pomperada, MAED-IT
// Email Address: jakerpomperada@yahoo.com and jakerpomperada@gmail.com

import java.util.Scanner;


class odd_even_checker {
    public int check_odd_even_number(int value)
    {
      if((value % 2) == 0) 
System.out.println("The given number is " + value + " is Even Number.");
else
System.out.println("The given number is " + value +  " is Odd Number.");
    return 0;
    }

 
public static void main(String args[]) {
  Scanner scan = new Scanner(System.in);
   char a;
do
    {
  // creating of an object
  
  odd_even_checker num = new odd_even_checker();
      
  System.out.println();
  System.out.println("===== ODD OR EVEN NUMBER CHECKER =====");
  System.out.println();
  System.out.print("Enter a Number :  ");
  int number_given =   scan.nextInt();
  
  System.out.println();
     num.check_odd_even_number(number_given);
  System.out.println("\n\n");
  System.out.print("Do you Want To Continue (Y/N) :=> ");
   a=scan.next().charAt(0);

   } while(a=='Y'|| a=='y');
          System.out.println("\n");
          System.out.println("\t ===== END OF PROGRAM ======");
         System.out.println("\n");
 }
  
   } // End of Program






















Circles in CSS

I this article I would like to share with you a sample CSS codes that will create a circle. CSS or Cascading Style Sheet is very basic and fundamentals to learn if you want to learn web development. The CSS tags are very short and easy to understand I hope you will learn from this. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.




Sample Web Page Output



Source Code Listing

<html>
 <head>
  <title>
     Circles Demo in CSS
  </title>
   <meta charset="utf-8">
  </head> 
  <style>
 .circle_orange {
  width: 47px;
  height: 47px;
  border-radius: 50%;
  background-color: #f58025;
  border: solid 0.5px #e0e0e0;
  
}
  
  .layer_circle1 {
  object-fit: contain;
  font-family: HiraKakuPro-W3;
  font-size: 12px;
  font-weight:bold;
  line-height: 3.67;
  text-align: center;
  color: #ffffff;
  
}
  
   .circle_gray {
  width: 47px;
  height: 47px;
  border-radius: 50%;
  background-color: lightgray;
  border: solid 0.5px #e0e0e0;
  
}
  
  .layer_circle2 {
  object-fit: contain;
  font-family: HiraKakuPro-W3;
  font-size: 12px;
  font-weight:bold;
  line-height: 3.67;
  text-align: center;
  color: gray;
  
}
  
 </style>
  
  <body>
    <div class="circle_orange layer_circle1"> 
      Demo
</div>
<br>
<div class="circle_gray layer_circle2"> 
  Test</div>
  </body>
</html>  

Saturday, July 1, 2017

Addition of Numbers Using Functions and Arrays in C++

A very simple program that I wrote during the time I'm still working as university professor to add the sum of three numbers using functions and one dimensional array in C++. I hope you will find my work useful.  Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Program Listing

#include <iostream>


 using namespace std;

int addition(int a, int b, int c)
{
    cout << "The sum of "
      << a << "," << b <<  " and "
      <<  c << " is "
      << (a + b + c) << ".";
}

main() {
    int a[2];
    cout << "\t\t ADDITION USING FUNCTION";
    cout << "\n\n";
    cout << "Enter a Value No. 1 ";
    cin >> a[0];
    cout << "Enter a Value No. 2 ";
    cin >> a[1];
    cout << "Enter a Value No. 3 ";
    cin >> a[2];
    cout << "\n";
    addition(a[0],a[1],a[2]);
    cout << "\n\n";
    system("pause");
}



Manpower Information System in PHP and MySQL

Here there in this article I would like to share with you the work of my friend and fellow software engineer and web developer Mr. Pindar Jimenez I requested him if he can share with us his work and I am glad he share it with us. Thank you very much Pindar.  About this program it is a manpower information system written in PHP and MySQL which allows the user to store and process applicants records. I hope you will find the work of Mr. Pindar Jimenez useful in your learning in web development and design using PHP and MySQL. Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



DOWNLOAD SOURCE CODE HERE





Student Information System in Swing Java

Here is a simple CRUD application that I named Student Information System in Swing Java that I wrote using Java programming language. Which allows the user to add, update, view and delete student records. All the student records in being store in a text file. The application is very basic and simple for learners to understand how Swing library in Java works. I hope you will find my work useful. I enjoy every minute working in this sample program. By the way I am using Netbeans as my tool in developing this program.  Thank you.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.








Sample Program Output


Program Listing

Student.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 student_info_system;


import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileReader;

import java.io.FileWriter;

import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;

/**
 *
 * @author Jake R. Pomperada, MAED-IT
 * Date: July 1, 2017, Saturday
 * Email : jakerpomperada@gmail.com and jakerpomperada@outlook.com
 */
public class Student extends javax.swing.JFrame {

    /**
     * Creates new form Student
     */
    public Student() {
        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() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        txtID = new javax.swing.JTextField();
        txtFirstName = new javax.swing.JTextField();
        txtMiddleName = new javax.swing.JTextField();
        txtCourse = new javax.swing.JTextField();
        btnAdd = new javax.swing.JButton();
        btnClear = new javax.swing.JButton();
        btnQuit = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        Table = new javax.swing.JTable();
        btnUpdate = new javax.swing.JButton();
        btnDelete = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        txtLastName = new javax.swing.JTextField();

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        jScrollPane1.setViewportView(jTable1);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setBackground(new java.awt.Color(204, 204, 204));
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel1.setText("Student ID");

        jLabel2.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel2.setText("First Name");

        jLabel3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel3.setText("Middle Name");

        jLabel4.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel4.setText("Last Name");

        txtFirstName.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtFirstNameActionPerformed(evt);
            }
        });

        txtCourse.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtCourseActionPerformed(evt);
            }
        });

        btnAdd.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnAdd.setText("Add");
        btnAdd.setToolTipText("Click here to save student records.");
        btnAdd.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddActionPerformed(evt);
            }
        });

        btnClear.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnClear.setText("Clear");
        btnClear.setToolTipText("Click here to clear the text box.");
        btnClear.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnClearActionPerformed(evt);
            }
        });

        btnQuit.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnQuit.setText("Quit ");
        btnQuit.setToolTipText("Click here to quit the program");
        btnQuit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnQuitActionPerformed(evt);
            }
        });

        Table.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {

            }
        ));
        Table.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                TableMouseClicked(evt);
            }
        });
        jScrollPane2.setViewportView(Table);

        btnUpdate.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnUpdate.setText("Update");
        btnUpdate.setToolTipText("Click here to update the student record.");
        btnUpdate.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnUpdateActionPerformed(evt);
            }
        });

        btnDelete.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnDelete.setText("Delete");
        btnDelete.setToolTipText("Click here to remove the student record.");
        btnDelete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDeleteActionPerformed(evt);
            }
        });

        jLabel5.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jLabel5.setText("Course");

        jLabel6.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel6.setText("Student Information System");

        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()
                        .addGap(20, 20, 20)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 411, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 91, Short.MAX_VALUE))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel1)
                                    .addComponent(jLabel2)
                                    .addComponent(jLabel3)
                                    .addComponent(jLabel4)
                                    .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(30, 30, 30)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txtID)
                                    .addComponent(txtFirstName)
                                    .addComponent(txtMiddleName)
                                    .addComponent(txtCourse, javax.swing.GroupLayout.DEFAULT_SIZE, 143, Short.MAX_VALUE)
                                    .addComponent(txtLastName))
                                .addGap(26, 26, 26)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(btnClear, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(btnUpdate, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(btnAdd, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(btnDelete, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(btnQuit, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jScrollPane2)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addComponent(jLabel6)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(txtID, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnAdd))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(txtFirstName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnUpdate))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtMiddleName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(btnDelete))
                .addGap(32, 32, 32)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(txtLastName, 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(jLabel5)
                    .addComponent(txtCourse, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnClear)
                    .addComponent(btnQuit))
                .addGap(18, 18, 18)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 138, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(20, 20, 20))
        );

        pack();
    }// </editor-fold>                        

    private void txtFirstNameActionPerformed(java.awt.event.ActionEvent evt) {                                             
        // TODO add your handling code here:
    }                                            
    
    DefaultTableModel mod;
    String Id, FirstName, MiddleName, LastName,Course, line;
  
    
    private void formWindowOpened(java.awt.event.WindowEvent evt) {                                  
        mod = (DefaultTableModel)Table.getModel();
        mod.addColumn("ID");
        mod.addColumn("FIRST NAME");
        mod.addColumn("MIDDLE NAME");
        mod.addColumn("LAST NAME");
        mod.addColumn("COURSE");        
        
        try{
        BufferedReader bfw = new BufferedReader(new FileReader("student_db.txt"));
        while( (line = bfw.readLine() ) != null ) {
        mod.addRow( line.split(",") );
        }
            bfw.close();
        }
        catch(Exception ex){
        }

    }                                 

    private void btnAddActionPerformed(java.awt.event.ActionEvent evt) {                                       
        this.Id = txtID.getText().toUpperCase();
        this.FirstName = txtFirstName.getText().toUpperCase();
        this.MiddleName = txtMiddleName.getText().toUpperCase();
        this.LastName = txtLastName.getText().toUpperCase();
        this.Course = txtCourse.getText().toUpperCase();
              
        this.txtID.setText("");
        this.txtFirstName.setText("");
        this.txtMiddleName.setText("");
        this.txtLastName.setText("");
        this.txtCourse.setText("");
        
        String st[] = {Id, FirstName, MiddleName, LastName,Course};
        mod.addRow(st);
        saveFile();
        
        this.txtID.requestFocus();
    }                                      

    private void saveFile(){
        try{
          File file = new File("student_db.txt");
          if(!file.exists()){
              file.createNewFile();
          }
          FileWriter fw = new FileWriter(file.getAbsoluteFile());
          BufferedWriter bw = new BufferedWriter(fw);
          
          for(int i=0; i<Table.getRowCount(); i++){
              for(int j=0; j<Table.getColumnCount(); j++){
                  bw.write((String)Table.getModel().getValueAt(i,j)+",");
              }
              bw.write("\n");
          }
        bw.close();
        fw.close();
      }catch(Exception ex){
          
      }
    }
    private void btnQuitActionPerformed(java.awt.event.ActionEvent evt) {                                        
       String message = "Do you want to quit the program?";
       String title = "Really Program Quit?";

    int reply = JOptionPane.showConfirmDialog(null, message, title, JOptionPane.YES_NO_OPTION);
    
    if (reply ==JOptionPane.NO_OPTION)
    {
        this.txtID.setText("");
        this.txtFirstName.setText("");
        this.txtMiddleName.setText("");
        this.txtLastName.setText("");
        this.txtCourse.setText(""); 
        this.txtID.requestFocus();
    }
    
    if (reply == JOptionPane.YES_OPTION)
    {
      System.exit(0);
    }
        
     
      
    }                                       

    private void TableMouseClicked(java.awt.event.MouseEvent evt) {                                   
        int index =Table.getSelectedRow();
        TableModel model = Table.getModel();
        Id = model.getValueAt(index, 0).toString().toUpperCase();
        FirstName = model.getValueAt(index, 1).toString().toUpperCase();
        MiddleName = model.getValueAt(index, 2).toString().toUpperCase();
        LastName = model.getValueAt(index, 3).toString().toUpperCase();
        Course = model.getValueAt(index, 4).toString().toUpperCase();
               
        txtID.setText(Id);
        txtFirstName.setText(FirstName);
        txtMiddleName.setText(MiddleName);
        txtLastName.setText(LastName);
        txtCourse.setText(Course);
    }                                  

    private void btnUpdateActionPerformed(java.awt.event.ActionEvent evt) {                                          
        mod = (DefaultTableModel) Table.getModel();
        
        if(Table.getSelectedRow()==-1){
            if(Table.getRowCount()==0){
                JOptionPane.showMessageDialog(rootPane,"Table is Empty");
            }else{
                JOptionPane.showMessageDialog(rootPane, "You must select a record");
            }
        }else{
            mod.setValueAt(txtID.getText().toUpperCase(),Table.getSelectedRow(), 0);
            mod.setValueAt(txtFirstName.getText().toUpperCase(), Table.getSelectedRow(), 1);
            mod.setValueAt(txtMiddleName.getText().toUpperCase(), Table.getSelectedRow(), 2);
            mod.setValueAt(txtLastName.getText().toUpperCase(), Table.getSelectedRow(), 3);
            mod.setValueAt(txtCourse.getText().toUpperCase(), Table.getSelectedRow(), 4);
        }
              
        saveFile();
    }                                         

    private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {                                          
        mod = (DefaultTableModel) Table.getModel();
        
        if(Table.getSelectedRow()==-1){
            if(Table.getRowCount()==0){
                JOptionPane.showMessageDialog(rootPane,"Table is Empty");
            }else{
                JOptionPane.showMessageDialog(rootPane, "You must select a record");
            }
        }else{
            JOptionPane.showMessageDialog(rootPane, "Record is deleted!");
            mod.removeRow(Table.getSelectedRow());
            this.txtID.setText("");
            this.txtFirstName.setText("");
            this.txtMiddleName.setText("");
            this.txtLastName.setText("");
            this.txtCourse.setText("");
            
            this.txtID.requestFocus();
        }
        saveFile();
    }                                         

    private void txtCourseActionPerformed(java.awt.event.ActionEvent evt) {                                          
        // TODO add your handling code here:
    }                                         

    private void btnClearActionPerformed(java.awt.event.ActionEvent evt) {                                         
            this.txtID.setText("");
            this.txtFirstName.setText("");
            this.txtMiddleName.setText("");
            this.txtLastName.setText("");
            this.txtCourse.setText("");
            
            this.txtID.requestFocus();
    }                                        

    /**
     * @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(Student.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(Student.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(Student.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(Student.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 Student().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JTable Table;
    private javax.swing.JButton btnAdd;
    private javax.swing.JButton btnClear;
    private javax.swing.JButton btnDelete;
    private javax.swing.JButton btnQuit;
    private javax.swing.JButton btnUpdate;
    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.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JTable jTable1;
    private javax.swing.JTextField txtCourse;
    private javax.swing.JTextField txtFirstName;
    private javax.swing.JTextField txtID;
    private javax.swing.JTextField txtLastName;
    private javax.swing.JTextField txtMiddleName;
    // End of variables declaration                   
}