Tuesday, September 1, 2015

Average Grade Checker in PHP


I have here a program that I wrote in my programming class in PHP before I called this program Average Grade Checker in PHP that will compute the grade of the student from prelim, midterm, prefinal and endterm grading period. The code is very easy to understand and very useful for those you are just starting learning PHP programming.

If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at  my mobile number 09173084360.

Thank you very much and Happy Programming.


Program Listing


<html>
<head> <center> <u> <font size="6" color="darkblue"> Average Grade Checker
<title> Grade Checker </title>
</font> </u> </center> </head>
<body bgcolor="lightgreen">

<?php
error_reporting(0);

if ($_REQUEST['submit'])
{
$prelim=trim($_REQUEST['prelim']);
$midterm=trim($_REQUEST['midterm']);
$pfinal=trim($_REQUEST['pfinal']);
$final=trim($_REQUEST['final']);
$grade=($prelim+$midterm+$pfinal+$final)/4;

if ($grade>=75)
{
echo "<script>";
echo "alert('You Passed.');";
echo "</script>";
}
else
{
echo "<script>";
echo "alert('You Failed.');";
echo "</script>";
}

}

if ($_REQUEST['clear'])
{
$prelim="";
$midterm="";
$pfinal="";
$final="";
$grade="";
}
?>

<form method="post" action="">
<label> Prelim Grade: </label> <br/>
<input type="text" name="prelim" value="<?php echo $prelim; ?>" 
<label> Midterm Grade: </label> <br/>
<input type="text" name="midterm" value="<?php echo $midterm; ?>" 
<label> Prefinal Grade: </label> <br/>
<input type="text" name="pfinal" value="<?php echo $pfinal; ?>" 
<label> Final Grade: </label> <br/>
<input type="text" name="final" value="<?php echo $final; ?>" 
<label> Average Grade: </label> </br>
<input type="text" name="grade" value="<?php echo $grade; ?>" 
<br><br>
<input type="submit" name="submit" value="Submit">
<input type="submit" name="clear" value="Clear">
</form>

</body>
</html>


Picture Uploader in PHP and MySQL

In this article I would like to share with you a program that I wrote which enables the user to upload and display picture using PHP and MySQL. This code is very good in creating user profile system which requires photo or images of the persons.

If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at  my mobile number 09173084360.

Thank you very much and Happy Programming.



Monday, August 31, 2015

Low and High Number Checker Using Two Dimensional Array in C++

In this program it will ask the use to enter two numbers and then the program will compare and determine which to the two number is the higher and the lowest in terms of value using two dimensional array in C++.

If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at  my mobile number 09173084360.

Thank you very much and Happy Programming.


Sample Program Output

Program Listing


#include <iostream>

using namespace std;

void display(void)
{
 int high=0,low=0;

int val[2][1];

cout << "\t Low and High Number Checker 1.0";
cout << "\n\n";
cout << "Enter two numbers :=> ";
cin >> val[0][0] >> val[1][0];

 if (val[0][0] > val[1][0]){
     high = val[0][0];
     low = val[1][0];
 }
    else if (val[1][0] > val[0][0] ){
     high = val[1][0];
     low = val[0][0];
 }
 else if (val[1][0] == val[0][0])
 {
     cout << "\n\n";
     cout << "They have the same value. Try Again";
 }
 cout << "\n=======================";
 cout << "\n   Display Result      ";
 cout << "\n=======================";
 cout << "\n\n";
 cout << "\n Highest Number ==> " << high << ".";
 cout << "\n Lowest  Number ==> " << low <<  ".";
 cout << "\n\n";
 system("pause");
}

main()
{
 display();
}


Square and Cube Root in C++

This article show you how to use for loop iteration statement in C++ and the use of functions I called this program Square and Cube Root in C++.  That will ask the user to enter a number and then it will generate the square and cube root value of the given number.

If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at  my mobile number 09173084360.

Thank you very much and Happy Programming.


Sample Program Output

Program Listing

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

using namespace std;

 ofstream file("output.txt");

int square_cube(int x_value)
{
    cout <<"\n\n";

    cout <<setw(3)<< "\n Number" << setw(12)
            << "SQUARE" << setw(14)
            << "CUBE ROOT";
            cout << "\n";
    for (int y=1; y<= x_value; y+=1)
    {
        cout <<"\n"<<setw(5) << y << setw(12)
             << y * y << setw(12)
             << y * y * y;
    }

    file << "\t SQUARE AND CUBE ROOT VERSION 1.0";
    file <<"\n\n";

    file <<setw(3)<< "\n Number" << setw(12)
            << "SQUARE" << setw(14)
            << "CUBE ROOT";
            file << "\n";
    for (int y=1; y<= x_value; y+=1)
    {
        file <<"\n"<<setw(5) << y << setw(12)
             << y * y << setw(12)
             << y * y * y;
    }
    file.close();
    cout << "\n\n";
    system("pause");
}



main() {
    ofstream file("output.txt");

    int value=0;
    cout << "\n\n";
    cout << "\t SQUARE AND CUBE ROOT VERSION 1.0";
    cout << "\n\n";
    cout << "Enter a Number :=> ";
    cin >> value;

    square_cube(value);
}



Addition of Two Numbers Using Pointers and Classes in C++

A simple program that I wrote in C++ that will ask the user to enter a number and then our program will find the sum of two numbers using pointers and classes as our data structure in C++ programming.

If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at  my mobile number 09173084360.

Thank you very much and Happy Programming.


Sample Program Output

Program Listing

#include <iostream>

using namespace std;

class add {
public:
    int a,b;

 int convert(int *a, int *b )
     {
     return(*a+*b);

     }
};

 main() {
    add values;
    char reply;

  while (1) {
    system("cls");
    cout << "\n\n\t Addition Program Using Class and Pointers ";
    cout << "\n\n \t Created By: Mr. Jake R. Pomperada, MAED-IT";
    cout << "\n";
    cout << "\n\n Enter the first value  : ";
    cin >> values.a;
    cout << "\n Enter the second value : ";
    cin >> values.b;
    cout << "\n\n";
    cout << " The total sum is ";
    cout << values.convert(&values.a,&values.b);
    cout << ".";
    cout <<"\n\n";
    cout << " More Y/N :=> ";
    cin >> reply;

    if (reply == 'N' || reply == 'n') {
        cout << "\n\n";
        cout << "\t Thank You For Using This Program :-D";
        break;
    }
    }
    cout << "\n\n\n\n";
    system("pause");
}


Addition of Five Numbers Using Class in C++

In this article I would like to share with you how to declare and use a class in C++. This program I called addition of three numbers using a class in C++. It will ask the user to enter five numbers and then it will compute and display the total sum of the three numbers.

If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at  my mobile number 09173084360.

Thank you very much and Happy Programming.


Sample Program Output

Program Listing

#include <iostream>

 using namespace std;

 class add {
     public:
     int a,b,c,d,e;

     int solve(int a,int b,int c, int d, int e)
      {
          return(a+b+c+d+e);
      }
 };


 main() {

      add values;

     cout << "\n\t Addition of Numbers ";
     cout << "\n\n";
     cout << "Enter five numbers : ";
     cin >> values.a >> values.b
         >> values.c >> values.d
         >> values.e;
     cout << "\n\n";
     cout << "The total sum "
          << values.solve(values.a,values.b,
                   values.c,values.d,
                   values.e) << ".";
     cout << "\n\n";
     system("pause");
 }






Student Average Grade Solver Using Classes in C++

In this article I would like to share with you a program that I wrote before for my programming class in C++ I called this program student average grade solver using classes in C++.  What does the program will do is to ask the name of the students, subject and its responding grade and then the program will compute the average grade of the student.

If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at  my mobile number 09173084360.

Thank you very much and Happy Programming.



Sample Program Output

Program Listing

#include <iostream>


using namespace std;

class students {
    public:
    int grade[3];
    string name;
    char subjects[3][500];
};


main() {

    students person;
    int x=0,sum=0,solve_grade=0;;

    cout << "\t\t Average Grade Solver 1.0";
    cout << "\n\n";

    cout << "Enter Student Name :";

    getline(cin,person.name);
      for (x=0; x<3; x++) {
         cin.ignore();
          cout << "\nEnter Subject Name :";

           gets(person.subjects[x]);
          cout << "Enter Subject Grades  :";
          cin >> person.grade[x];
            sum+= person.grade[x];
            solve_grade=(sum/3);
      }
      cout << "\n=============================";
      cout << "\n     Generated Report        ";
      cout << "\n=============================";
      cout << "\n";
      cout << "\n Student Name : " << person.name;
        cout << "\n";
        for ( x=0; x<3; x++) {

            cout <<"\n Subject : " << person.subjects[x];
            cout <<"\n Grade   : " << person.grade[x];
       }

        cout << "\n\n";
        cout << "Average Grade in 3 Subjects is  "
             << solve_grade <<".";
        cout << "\n\n";
        system("pause");
}



Basic Math Operations Using Classes in C++

In this article I would like to share with you a basic math operations using classes in C++. In basic mathematics there are four operations addition, subtraction, multiplication and division. In our example I am using classes, attributes and method to solve the problem. The code is very easy to understand and use a good way to learn object oriented programming using C++.

If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at  my mobile number 09173084360.

Thank you very much and Happy Programming.



Sample Program Output

Program Listing

#include <iostream>

 using namespace std;

 class math {

     private:
       int x,y;
       int sum,divide;

     public:
       int process_data();
       int display();
 };


 int math :: process_data()
 {
    cout << "\n \t Basic Math Operations";
    cout << "\n\n";
    cout<<"Enter x value: ";
cin>>x;
cout<<"Enter y value: ";
cin>>y;

    sum    = x + y;
    divide = x - y;

    cout<<"\n sum        = "<<sum
        <<"\n difference = "<<divide
   <<"\n quotient   = "<<x/y
   <<"\n product    = "<<x*y
   <<"\n remainder  = "<<x%y
        <<"\n";
    cout << "\n\n";
    system("pause");
 }

 int math :: display()
  {
      int basic;
      basic = process_data();
  }

  main() {
      math value;
      value.display();
  }



Area of the Triangle Using Classes in C++

In this article I would like to share with you again a program that I wrote that will solve the are of the triangle using classes in C++. The code is very easy to understand that teaches the fundamentals of object oriented programming in C++ programming language.

If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at  my mobile number 09173084360.

Thank you very much and Happy Programming.


Sample Program Output

Program Listing


#include <iostream>

  using namespace std;

  class triangle {

      public:
            double b,h;
  };

 main()
{
    triangle values;

    cout<<"\n [ Area of a triangle ]"<<endl;
    cout << "\n\n";
    cout<<"Enter Base    : ";
    cin>>values.b;
    cout<<"Enter Height  : ";
    cin>>values.h;
    cout << "\n\n";
    cout<<"Area = "
        <<(values.b*values.h)/2
        <<" square units ";
    cout << "\n\n";
    system("pause");
}

Prime Number Checker Using Classes in C++

A simple program that I wrote a long time ago while learning C++ object oriented programming I called this program prime number checker using classes in C++ that will ask the user to enter a number and then our program will check if the number given is prime number or not a prime number.

If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at  my mobile number 09173084360.

Thank you very much and Happy Programming.



Sample Program Outputn

Program Listing

#include <iostream>

using namespace std;

class prime {

  public:
   int n;

   int smalldiv (int n) {
  int count;
  count = 2;

  while (count < n && n % count != 0) {
    count = count + 1;
  }
  return(count);
}
};

 main () {

  prime value;

  cout << "\t Prime Number Checker 1.0";
  cout << "\n\n";

    while (1) {
        cout << "\n";
        cout << "Enter a number: ";
        cin >> value.n;
        if (value.n == 0) {
            cout << "\n\n";
            cout << "Thank you for using this Program.";
            break;
        }
        cout << "\n";
            if (value.n == value.smalldiv(value.n)) {
                cout  << value.n << " is a prime number" << endl;
            }
    else {
        cout << value.n << " is not a prime number" << endl;
        }

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



Rectangle Area Solver Using Classes in C++

In this article I would like to share with you a sample program that will compute the area and base of the rectangle using Classes in C++. The code will give you a first hand experience how to create an object, methods and attributes in object oriented programming in C++.

If you have some questions about programming, about my work please send me an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at  my mobile number 09173084360.

Thank you very much and Happy Programming.



Sample Program Output

Program Listing

#include <iostream>

 using namespace std;

 class rectangle {
   private:
   float base,height;

   public:

   float area(float b,float h)
    {
       return(b*h);
    }

    float process_data();
    float display_data();
 };

 float rectangle :: process_data()
   {
    cout << "\n";
    cout<<"\t\t AREA OF A RECTANGLE\n";
    cout << "\n";
    cout<<"\nEnter Base   : ";
    cin>>base;

    cout<<"\nEnter Height : ";
    cin>>height;

    cout << "\n\n";
    cout<<"\nArea = "
        <<area(base,height)
        <<" Square Units\n";
    cout << "\n\n";
    system("pause");
   }

   float rectangle :: display_data()
   {
       float math;

       math = process_data();
   }

main() {
    rectangle number;
    number.display_data();
}