Tuesday, December 15, 2015

Grade Solver Using Java

This program that I wrote before compute the grade of the student using Java as our programming language. The code is not very difficult and I am using applet to generate the graphical user interface. I hope you will find my program useful.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.



 Program Listing

    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.awt.Label;
    import java.text.DecimalFormat;

     public class grade extends Applet implements ActionListener{
      TextField txtprelim,txtmidterm,txtprefinal,txtendterm, txtfinal,txtremarks;
      Label lblprelim,lblmidterm,lblprefinal,lblendterm,lblfinal,lblremarks,title;
      Button button,clear;

 DecimalFormat dFormat = new DecimalFormat("0");
      public void init(){
        setLayout(null);


          title = new Label("Grade Solver 1.0");
          title.setBounds(90,20,150,20);
          add(title);
          title.setAlignment(title.CENTER);

        lblprelim = new Label("Prelim Grade ");
        lblprelim.setBounds(20,50,100,20);
        add(lblprelim);

        txtprelim = new TextField(5);
        txtprelim.setBounds(150,50,100,20);
        add(txtprelim);

        lblmidterm = new Label("Midterm Grade");
        lblmidterm.setBounds(20,90,100,20);
        add(lblmidterm);

        txtmidterm = new TextField(5);
        txtmidterm.setBounds(150,90,100,20);
        add(txtmidterm);

        lblprefinal = new Label("Prefinal Grade");
        lblprefinal.setBounds(20,130,130,20);
        add(lblprefinal);
        txtprefinal = new TextField(5);
        txtprefinal.setBounds(150,130,100,20);
        add(txtprefinal);


        lblendterm = new Label("Endterm Grade");
        lblendterm.setBounds(20,170,130,20);
        add(lblendterm);
        txtendterm = new TextField(5);
        txtendterm.setBounds(150,170,100,20);
        add(txtendterm);


        lblfinal = new Label("Final Grade");
        lblfinal.setBounds(20,210,100,20);
        add(lblfinal);
        txtfinal = new TextField(5);
        txtfinal.setBounds(150,210,100,20);
        add(txtfinal);


        lblremarks = new Label("Remarks");
        lblremarks.setBounds(20,250,100,20);
        add(lblremarks);
        txtremarks = new TextField(5);
        txtremarks.setBounds(150,250,100,20);
        add(txtremarks);

        button = new Button(" Solve Grade ");
        button.setBounds(70,280,100,20);
        add(button);

        clear = new Button(" Clear ");
        clear.setBounds(230,280,100,20);
        add(clear);

        button.addActionListener(this);
        clear.addActionListener(this);
        }

        public void actionPerformed(ActionEvent ae)
        {

      double prelim =Double.parseDouble(txtprelim.getText());
      double midterm =Double.parseDouble(txtmidterm.getText());
        double prefinal =Double.parseDouble(txtprelim.getText());
      double endterm =Double.parseDouble(txtmidterm.getText());
     
       double pre = (prelim * 0.2);      double pref = (prefinal * 0.2);
      double mid = (midterm * 0.2);   double endt = (endterm * 0.4);

      double compute_final_grade = (pre+mid+pref+endt);

       txtfinal.setBackground(Color.black);
       txtfinal.setForeground(Color.white);
       txtfinal.setText(dFormat.format(compute_final_grade));
       txtfinal.setEditable(false);

        if (compute_final_grade >= 75) {
            txtremarks.setBackground(Color.yellow);
            txtremarks.setForeground(Color.blue);
            txtremarks.setText("Passed");
        }
         else{
          txtremarks.setBackground(Color.yellow);
           txtremarks.setForeground(Color.red);
            txtremarks.setText("Failed");
        }
         txtremarks.setEditable(false);

            if(ae.getSource() == clear)
            {
             txtprelim.setText("");
              txtmidterm.setText("");
              txtprefinal.setText("");
               txtendterm.setText("");
               txtfinal.setText("");
               txtremarks.setText("");
               txtprelim.requestFocus();
    }
}
}


Ways to display a value of a variable in PHP

This very short program that I wrote using PHP as my programming language will give you an idea how to display a value of a variable in different ways in PHP that I have learned during the course of my learning in PHP programming. I intended this one for beginners in PHP programming.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.
 
 
 
Sample Program Output



Program Listing
 
<?php
$name1 = "John Smith";
$name2 = "Anna Morgan";
$name3 = "Nadine Samonte";

echo "Hello ",$name1," How are you? <br>";

echo "Hello ".$name2."<br>";


echo "Hello $name3";




Sunday, December 13, 2015

Sending Email in PHP

A program that I wrote before in PHP using PHP Mailer to send email using PHP as our primary language. The code is not very difficult but you must know how to use PHP Mailer and knows how to configure your gmail email account in order to use this program correctly.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.




Sample Program Output


Subject Information System in PHP and MySQL

This application I wrote a long time ago in PHP and MySQL that uses join sql queries to connect several tables to extract the needed information from several tables I called this program Subject Information System in PHP and MySQL. Feel free to use my code in your programming assignments and projects.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.


Sample Program Output



Passed and Failed Grade Lister in C language

I simple program that I wrote two years ago that will ask the user to give a series of grades pass and failing grades and then our program will counter how many grades given by the user is failed and passed. The code also teaches how to write and use one dimensional array in C language.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.
  


Program Listing

#include <stdio.h>
#include <stdlib.h>

main() {
    int list=0,pass=0,fail=0, grades[5];

     printf("\n\t\tPASS AND FAIL LISTER 1.0");
     printf("\n\n");
    for (list=0; list < 5; list++) {
        printf( "Enter Grade No  %d :", list+1 );
        scanf("%d",&list[grades]);
    }

        for (list=0; list < 5; list++) {

      if (list[grades] >= 75) {

         pass++;

     }

     else {
         fail++;
       }
    }


// display pass grades and failed grades
  printf("\n");
  printf("\n==============================");
  printf("\n====== Generated Report ======");
  printf("\n==============================");
  printf("\n\n");
  printf( "Passed Grades => ");

        for (list=0; list < 5; list++)


        {

      if (list[grades] >= 75) {

      printf(" %4d ",list[grades] );
     }

    }
 printf("\n");

printf("Failed Grades => ");

        for (list=0; list < 5; list++)
        {

      if (list[grades] < 75) {

        printf(" %4d ",list[grades] );
     }

    }

    printf("\n");
    printf("\nNumber of Passed Grades => %d. ",pass);
    printf("\nNumber of Failed Grades => %d. " ,fail);
    printf("\n\n");
    system("PAUSE");
    }
  // End of Code

Area of a Circle Solver in CodeIgniter

A simple program that I wrote that will ask the user to give the radius of the circle and then our program will compute the area of the circle based on the value of the radius provided by the user using CodeIgniter PHP framework.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.
  

Sample Program Output

Program Listing

<?php
error_reporting(0);

class circle extends CI_Controller
{

function index()
{
echo "<html>";
echo "<head>";
echo " <title>Area of a Circle Solver in CodeIgniter </title>";
echo "</head>";
echo "<style>";
echo "body {";
echo "font-family:arial;";
echo "}";
echo "</style>";
echo "<body>";

if(isset($_POST['submit'])){
   $radius = $_POST['radius'];
  
  $pi = 3.14159;
  $area = $pi * $radius * $radius;
  $solve= number_format($area, 2, '.', '');
  $result = "The area of the circle is " .$solve.".";
    
}

if(isset($_POST['clear'])){
   $radius="";
   $result = "";
  }

echo "<form action='' method='post' name='myform' align='center'>";
echo "<h3>Area of a Circle Solver in CodeIgniter </h3>";
echo "<br>";
echo "Give the radius of the circle &nbsp;&nbsp; <input type='text' name='radius' autofocus='true' value=$radius > ";
echo "<br><br>";
echo "<input type='submit' name='submit' value='Compute' ";
echo "title='Click here to find the area of the circle.' />";
echo "&nbsp;&nbsp;&nbsp;";
echo "<input type='submit' name='clear' value='Clear'";
echo "title='Click here to clear the text boxes.' />";
echo "</form>";
echo "<br>";
echo $result;

 }
}
?>


Do While Statement in C Language

A sample program that I wrote in C programming language to show how to declare and use the do while looping statement. The code is very simple I intended for beginners in C programming.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.
  

Program Listing

 #include <stdio.h>
#include <stdlib.h>

main()
{
int number=0;
system("cls");

number = 1;
do
{
 printf(" %d " ,number);
 number=number+1;
}while (number <=10);

printf("\n\n");
system("pause");
}

Functions and Parameters in C language

A simple program that I wrote using C programming language to demonstrate how to write a function with parameters good for beginners in C programming.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.
  

 Program Listing

#include <stdio.h>
#include <stdlib.h>

// declaration of function prototype

void hello(char user[50]);
// function with parameters

main()
{
system("cls");
// Calling the function with
// parameters
hello("John Smith");

printf("\n\n");
system("pause");
}

void hello(char user[50])
{
 printf("\t     Hello %s" ,user, ".");
 printf("\n\n");
 printf("\tWelcome To World City College");
}

Sum of Two Numbers in CodeIgniter

A sample program that I wrote using CodeIgniter one of the most popular PHP framework. What does the program will do is to ask the user to give to numbers and then our program will give the sum of the two numbers.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.
 

Sample  Program Output


Program Listing
 
 <?php

// create a file named "sum.php" and then save the file in the
// following path in CodeIgniter example below
// "C: /xammp/htdocs/Demo/application/controllers"

// To run the application follow the commands below
// http://localhost/ci/index.php/sum

 error_reporting(0);

class sum_two_numbers extends CI_Controller
{

function index()
{
echo "<html>";
echo "<head>";
echo " <title>Sum of Two Numbers in CodeIgniter</title>";
echo "</head>";
echo "<style>";
echo "body {";
echo "font-family:arial;";
echo "}";
echo "</style>";
echo "<body>";

if(isset($_POST['submit'])){
   $num1 = $_POST['num1'];
   $num2 = $_POST['num2'];
   $result = $num1 + $num2;
  
}

if(isset($_POST['clear'])){
   $num1 = "";
   $num2 = "";
   $result = "";
  }

echo "<form action='' method='post' name='myform' align='center'>";
echo "<h3>Sum of Two Numbers in CodeIgniter </h3>";
echo "<br>";
echo "Enter number 1:&nbsp;&nbsp; <input type='text' name='num1' autofocus='true' value=$num1  > ";
echo "<br>";
echo "Enter number 2: &nbsp;&nbsp;<input type='text' name='num2' value=$num2>";
echo "<br><br>";
echo "<input type='submit' name='submit' value='Sum' ";
echo "title='Click here to find the sum of two numbers.' />";
echo "&nbsp;&nbsp;&nbsp;";
echo "<input type='submit' name='clear' value='Clear'";
echo "title='Click here to clear the text boxes.' />";
echo "</form>";
echo "<br>";
echo "<table border='1' align='left'>";
echo "<td align='center'>Value No. 1</td>";
echo "<td align='center'>Operator</td>";
echo "<td align='center'>Value No. 2</td><td align='center'>Total Sum";
echo "</td></tr>";
echo "<tr><td align='center'>";
echo $num1;
echo "</td><td align='center'>+";
echo "</td><td align='center'>";
echo $num2;
echo "</td><td align='center'>";
echo $result;
echo "</td></tr>";
echo "</table>";

 }
}
?>
 
 

Employee's Information System in Visual Basic 6

A simple program that I wrote in Visual Basic 6 and Microsoft Access to manage the employee's records in the company. The code is very simple and easy to understand ideal for beginners.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.
 
 
 
Sample Program Output
 
 
 
 

Sunday, December 6, 2015

Persons Information System in PHP and MySQL

This program that I wrote in PHP and MySQL I made for my web programming class in PHP and MySQL I called this program Persons Information System that will store and process the information of a particular person in our database. It demonstrate how to use basic CRUD operations in PHP and MySQL. I hope you will find my work useful.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com


My mobile number here in the Philippines is 09173084360.



Sample Program Output

Tuesday, December 1, 2015

Area of a Square in JavaScript

This sample program will solve for the area of a square using JavaScript as our programming language.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.


Program Listing
 
 <html>
     <head>
         <Title>Area of a Square in JavaScript</Title>
     </head>   
       
    <body>   
  <h1> Area of a Square in JavaScript </h1>
<br>     

    Base :
      <input type="text" id="Base"/>
         <BR>
     Height:          :
      <input type="text" id="Height"/>
         <BR>   
  
         &nbsp;&nbsp;
             <input
                   type="button"
                   id="btnArea"
                    onclick="Area();"
                    value = "Compute"/>
             <div id = "divresult"></div>
     </body>
            
      <script>
           function Area(){
               var Base = document.getElementById("Base");
              var Height = document.getElementById("Height");
               var basevalue = Base.value;
               var heightvalue = Height.value;
               var result = (basevalue*heightvalue)/2;
               var divresult=document.getElementById("divresult");
               divresult.innerHTML=result;
           }
     </script>
                         
    </html>

String and Math Functions in JavaScript

This sample program will show you basic string and math built in functions in JavaScript that is very handy to use in our programming assignments and projects. I hope you will find our sample program useful.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.
 

Program Listing

<html>
    <head>
        <title> String and Math Functions</title>
        <script language = "Javascript">


        function dblenum(i)
        {
            dblnumber = numb * numb;
            return(dblnumber);
        }


        var name = prompt ("Enter your name:","");
        var numb = parseInt (prompt ("Enter any number:"," "));
        var deit = prompt ("Enter the date:","");
        var dt = new Date(deit);
       
        var sqre = dblenum (numb);

        document.write ("<center>");
        document.write ("Lowercase:     ",name.toLowerCase(),"<br>");
        document.write ("Uppercase:     ",name.toUpperCase(),"<br>");
        document.write ("Length:        ",name.length,"<br>");
        document.write ("Double:        ",sqre,"<br>");
        document.write ("Square Root:   ",Math.sqrt(numb),"<br>");
        document.write ("Round Off:     ",Math.round(numb),"<br>");
        document.write ("Date: Day   -  ",(dt.getDay()+1),"<br>");
        document.write ("      Month -  ",(dt.getMonth()+1),"<br>");
        document.write ("      Date  -  ",dt.getDate(),"<br>");
        document.write ("      Year  -  ",dt.getYear(),"<br>");
       
        </script>
    </head>

<body bgcolor = "green" text = "white">

</body>
</html>
 



Post command in PHP

This sample program will show you how to use POST command in PHP to accept and pass the value from one web page to another web page.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.
 
 
Program Listing
 
post.php
 
 <html>
<body>
<form action="welcome.php" method="post">
Name: <input type="text" name="fname" />
Age: <input type="text" name="age" />
<input type="submit" />
</form>
</body>
</html>

welcome.php
 
<html>
<body>
Welcome <?php echo $_POST["fname"]; ?>!<br />
You are <?php echo $_POST["age"]; ?> years old.
</body>
</html>

Upload and Download Files in PHP and MySQL

A simple program that I wrote years ago that enables the user to upload and download files from a file server using PHP and MySQL. The code is not very difficult to understand and use.

If you  have some questions please send me an email at jake.r.pomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.





 

Sample Program Output