Saturday, October 15, 2016

Compute the Area of the Circle in Java

Here is one of the oldest code in Java when I start learning how to program on it to compute the area of the circle in this example I am still using buffered reader in order to accept input values from the user.

Add me at Facebook my addressis jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 


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

My mobile number here in the Philippines is 09173084360.


Program Listing

import java.io.*;

public class area_circle {

public static void main(String [] args) throws Exception
{
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
int radius=0;
double pi, area;
System.out.println("Compute Area of a Circle\n");
System.out.print("Enter a value for radius: ");
radius = Integer.parseInt(input.readLine());
pi = 3.1416;
area = (pi * (radius * radius));
System.out.println("\nThe value for radius is: " + radius);
System.out.println("\nThe value for pi is: " + pi);
System.out.println("\nThe area of a circle is: " + area + "\n\n\n" );
System.out.println("\n\n\n" );
System.out.println("End of Program" );
}
}

Addition of Two Numbers in Ruby

A very simple program that I wrote using Ruby as my programming language that will ask the user to give two numbers and then our program will compute for the sum of the two numbers.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

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

My mobile number here in the Philippines is 09173084360.


Program Listing


print "\n\n";
print "Sum of Two Numbers in Ruby"
print "\n\n";
print "enter number 1 : ";
val1 = gets;
print "enter number 2 : ";
val2 = gets;

val1 = val1.to_i
val2 = val2.to_i

sum = sum.to_i

sum = (val1 + val2)

print "\n\n";
puts "The sum of #{val1} and #{val2} is #{sum}."
print "\n\n";
print "End of Program";
print "\n\n";


Product of Two Numbers in Ruby

A very simple program that I wrote using Ruby as my programming language that will ask the user to give two numbers and then our program will compute for the product of the two numbers.

Add me at Facebook my addressis jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

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

My mobile number here in the Philippines is 09173084360.



Program Listing

print "\n\n";
print "Product of Two Numbers in Ruby"
print "\n\n";
print "enter number 1 : ";
val1 = gets;
print "enter number 2 : ";
val2 = gets;

val1 = val1.to_i
val2 = val2.to_i

product = product.to_i

product = (val1 * val2)

print "\n\n";
puts "The product of #{val1} and #{val2} is #{product}."
print "\n\n";




Student Grading Database System in C

A simple program that I wrote to show database development using Binary File in C programming language. I called this application Student Grading Database System in C which enables the user to add, edit, delete, view and quit student grade records it stores the record of the student in the binary file. I am using Dev C++ as my C compiler but the I code can also run in a typical Borland Turbo C or Turbo C++ compiler in DOS. I hope you will find my work useful. Thanks a lot.

Add me at Facebook my addressis jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

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

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#include <ctype.h>

main( )
{
FILE  *fp, *ft ;
char  another, choice ;
struct student
{
char  stud_id_no[300];
char  name[300];
char  course[300];
char  subject[300];
float prelim,midterm,endterm,final_grade;
} ;
struct student grade;
char student_id[300];
long int  recsize;
    int flag=0;

fp = fopen ("GRADE_DB.DAT", "rb+" ) ;

if ( fp == NULL )
{
fp = fopen ( "GRADE_DB.DAT", "wb+" ) ;

if ( fp == NULL )
{
puts ( "Cannot open file" ) ;
exit(0) ;
}
}

recsize = sizeof ( grade ) ;

while ( 1 )
{
        system("CLS");
        printf("\n");
printf("\n======================================");
printf("\n");
printf("\nSTUDENT GRADING DATABASE SYSTEM ");
printf("\n");
printf("\n======================================");
printf("\n\n");
printf ( "1. INSERT STUDENT RECORD" ) ;
printf("\n");
printf ( "2. BROWSE STUDENT RECORD" ) ;
printf("\n");
printf ( "3. EDIT STUDENT RECORDS" ) ;
printf("\n");
printf ( "4. FIND STUDENT RECORDS" ) ;
printf("\n");
printf ( "5. REMOVE STUDENT RECORDS" ) ;
printf("\n");
printf ( "6. QUIT PROGRAM" ) ;
printf("\n\n");
printf ("SELECT YOUR OPTION :=> " ) ;
fflush (stdin) ;
choice = getche() ;
switch ( choice )
{
case '1' :

fseek ( fp, 0 , SEEK_END ) ;
another = 'Y' ;

while ( another == 'Y' )
{
system("cls");
printf("\n\n");
printf("=== INSERT NEW STUDENT GRADE RECORD ===");
printf("\n\n");
printf("Enter Student ID Number      : ");
                    scanf("%s",&grade.stud_id_no);
printf("Enter Student Name           : ");
fflush (stdin) ;
gets(grade.name);
printf("Enter Course                 : ");
fflush (stdin) ;
gets(grade.course);
                    printf("Enter Subject                  : ");
fflush (stdin) ;
gets(grade.subject);
printf("Enter Prelim Grade           : ");
scanf("%f",&grade.prelim);
printf("Enter Midtem Grade           : ");
scanf("%f",&grade.midterm);
printf("Enter Endterm Grade           : ");
scanf("%f",&grade.endterm);
grade.final_grade = (grade.prelim * 0.30) + (grade.midterm * 0.30) + (grade.endterm * 0.40);
printf("\n");
                    printf("\n Student Final Grade         : %2.0f",grade.final_grade);
fwrite (&grade, recsize, 1, fp ) ;
printf("\n\n");
printf ( "\nAdd New Student Record (Y/N)  : " ) ;
fflush (stdin) ;
another = toupper(getche()) ;
}

break ;

case '2' :
           system("cls");
rewind ( fp );
printf("\n\n");
                printf("=== VIEW STUDENT GRADE RECORD ===");
                printf("\n\n");
while ( fread ( &grade, recsize, 1, fp ) == 1 )
            {
                printf("\n");
                printf("\n ID  Number          : %s",grade.stud_id_no);
                printf("\n Name                : %s",grade.name);
                printf("\n Course              : %s",grade.course);
                printf("\n Subject             : %s",grade.subject);
                printf("\n Prelim Grade        : %2.0f",grade.prelim);
                printf("\n Midterm Grade       : %2.0f",grade.midterm);
                printf("\n Endterm Grade       : %2.0f",grade.endterm);
                printf("\n");
                grade.final_grade = (grade.prelim * 0.30) + (grade.midterm * 0.30) + (grade.endterm * 0.40);
                printf("\n Student Final Grade         : %2.0f",grade.final_grade);
     }
                printf("\n\n");
                system("pause");
break ;

case '3' :
   another = 'Y' ;
while ( another == 'Y' )
{
   system("cls");
           printf("=== EDIT STUDENT GRADE RECORD ===");
           printf("\n\n");
printf("Enter Student ID Number      : ");
                    scanf("%s",&student_id);
rewind ( fp ) ;
printf("\n");

while ( fread ( &grade, recsize, 1, fp ) == 1 )
{
if ( strcmp ( grade.stud_id_no, student_id) == 0 )
{
printf("Enter Student ID Number      : ");
                            fflush (stdin) ;
                            gets(grade.stud_id_no);
printf("Enter Student Name     : ");
fflush ( stdin ) ;
gets(grade.name);
       printf("Enter Course           : ");
fflush ( stdin ) ;
gets(grade.course);
printf("Enter Subject          : ");
fflush ( stdin ) ;
gets(grade.subject);
printf("Enter Prelim Grade     : ");
scanf("%f",&grade.prelim);
printf("Enter Midtem Grade     : ");
scanf("%f",&grade.midterm);
printf("Enter Endterm Grade    : ");
scanf("%f",&grade.endterm);
printf("\n");
grade.final_grade = (grade.prelim * 0.20) + (grade.midterm * 0.30) + (grade.endterm * 0.50);
printf("\n Student Final Grade         : %2.0f",grade.final_grade);
fseek ( fp, - recsize, SEEK_CUR ) ;
fwrite ( &grade, recsize, 1, fp ) ;
break ;
}

}
if (strcmp(grade.stud_id_no,student_id) != 0 )
                    {
                        printf("\n\n");
                        printf("No Student Record in the Database.");
                        printf("\n");
                        system("pause");
                        break;
                    }
                    printf("\n\n");
printf ( "\nEdit Another Student Record (Y/N) : " ) ;
fflush ( stdin ) ;
another = toupper(getche());
}

break ;

case '4' :
          rewind ( fp ) ;
          another = 'Y' ;
while ( another == 'Y' )
{
   system("cls");
   printf("=== Find Student Records ===");
   printf("\n\n");
printf("Enter Student ID Number      : ");
                    scanf("%s",&student_id);
printf("\n");
rewind ( fp ) ;
while ( fread ( &grade, recsize, 1, fp ) == 1 )
{
if ( strcmp (grade.stud_id_no,student_id) == 0 )
{
                    printf("\n");
printf("\n ID Number           : %s",grade.stud_id_no);
printf("\n Name                : %s",grade.name);
printf("\n Course              : %s",grade.course);
           printf("\n Subject             : %s",grade.subject);
                    printf("\n Prelim Grade        : %2.0f",grade.prelim);
                    printf("\n Midterm Grade       : %2.0f",grade.midterm);
                    printf("\n Endterm Grade       : %2.0f",grade.endterm);
                    printf("\n");
                    grade.final_grade = (grade.prelim * 0.30) + (grade.midterm * 0.30) + (grade.endterm * 0.40);
                    printf("\n Student Final Grade         : %2.0f",grade.final_grade);
                    printf("\n\n");
                    system("pause");
                     break;
}
                    }

                    if (strcmp(grade.stud_id_no,student_id) != 0 )
                    {
                        printf("\n\n");
                        printf("No Student Record found in the Database.");
                        printf("\n");
                        system("pause");
                        break;
                    }
                    printf("\n\n");
printf ( "\n Find Another Student Record (Y/N) : " ) ;
fflush ( stdin ) ;
another = toupper(getche());
}

break ;

case '5' :
another = 'Y' ;
while ( another == 'Y' )
{
system("cls");
                    printf("=== REMOVE STUDENT GRADE RECORD ===");
                    printf("\n\n");
printf("Enter Student ID Number      : ");
                    scanf("%s",&student_id);
printf("\n");
ft = fopen ( "TEMP.DAT", "wb" ) ;
rewind ( fp ) ;
while ( fread ( &grade, recsize, 1, fp ) == 1 )
{
if ( strcmp (grade.stud_id_no, student_id) != 0 )
fwrite ( &grade, recsize, 1, ft ) ;
                        else
                            flag=1;
                    }
fclose ( fp ) ;
fclose ( ft ) ;
remove ( "GRADE_DB.DAT" ) ;
rename ( "TEMP.DAT", "GRADE_DB.DAT" ) ;
   fp = fopen ( "GRADE_DB.DAT", "rb+" ) ;

                  if(flag==1) {
                        printf("\n\n");
                        printf("Record Successfully Deleted From the Database.");
                         printf("\n");
                       system("pause");
                    }
else if (flag!=1) {
                        printf("\n\n");
                        printf("Record Not Found in the Database.");
                        printf("\n");
                        system("pause");

                    }
                    printf("\n\n");
printf( "Remove Another Student Record (Y/N) : " ) ;
fflush (stdin) ;
another = toupper(getche());
}
break ;

case '6' :
fclose ( fp ) ;
printf("\n\n");
printf("   END OF PROGRAM    ");
printf("\n\n");
system("PAUSE");
exit(0);

}
}
}




Meeting With the Father of PHP Programming Language

Last October 14, 2016 my cousin invited me for a dinner in one of the restaurant in Greenbelt 3 Makati City, Philippines while we are having our dinner I saw Rasmus Lerdorf the creator and father of PHP programming language eating also in the same restaurant.

I approach him and introduce myself I told him I am thankful because of your creator I have a job and I was able to support my family. He is smiling and happy to know that his work able to help our people not only in their work but also their lives as well. He is very kind and approachable people and the best part he is very humble too. 

For me PHP programming language is one of the best programming language in the world in terms in creating web applications their are some flaws on PHP but it can be improve.  Here is some of our pictures below.




With Rasmus Lerdorf Father of PHP Programming Language


Together With My Cousin Ken



Selfie Moment


Student Grade Viewer System in PHP and MySQL

In this article I would like to share with you a program that I and my friend and fellow software engineer Mr. Dave Marcellana develop we can't this application Student Grade Viewer System in PHP and MySQL. This application enables teachers act as administrator to upload the grades of their perspective students in their subject and then the students can view their grades online using this application. We are using twitter bootstrap for the design and layout of our web forms. I hope you will find our work useful. Thank you.

Add me at Facebook my addressis jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

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