Sunday, March 4, 2018

List of Armstrong Number in Java

A very simple program to list down the Armstrong numbers in Java.

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.


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

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.
 
 
Sample Program Output


Program Listing


public class Main {

    public static void main(String[] args) {
        int a =0;
        int num =0;

        int n, sum, temp, remainder, digits;

        int start = 100;
        int end =2000;

        System.out.println("\n\n");
        System.out.print("List of Armstrong Number in Java");
        System.out.println("\n");

        for (int i = start; i <= end; i++) {

            sum = 0;
            digits = 0;

            temp = i;

            while (temp != 0) {
                digits++;
                temp = temp / 10;
            }

            temp = i;

            while (temp != 0) {
                remainder = temp % 10;
                sum = sum + power(remainder, digits);
                temp = temp / 10;
            }

            if (i == sum)
                System.out.println(i + " is an Armstrong number.");

        }
        System.out.println();
        System.out.print("End of Program");
        System.out.println();
    }

    static int power(int n, int r) {
        int c, p = 1;

        for (c = 1; c <= r; c++)
            p = p * n;

        return p;
    }

    }

 

 

 

List of Prime Number in Java

A very simple program to list down the prime numbers from 1 to 220 using Java as our programming language.


I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.


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

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.
 
 
 
Sample Program Output
 
 
Program Listing
 
public class Main {

    public static void main(String[] args) {
        int a =0;
        int num =0;

        System.out.println("\n\n");
        System.out.print("List of Prime Number in Java");
        System.out.println("\n");

        String  primeNumbers = "";

        for (a = 1; a <= 220; a++)
        {
            int counter=0;
            for(num =a; num>=1; num--)
            {
                if(a%num==0)
                {
                    counter+=1;
                }
            }
            if (counter ==2)
            {

                primeNumbers += a + " ";
            }
        }
        System.out.println("Prime numbers from 1 to 220 are :");
        System.out.println(primeNumbers);
        System.out.println();
        System.out.print("End of Program");
        System.out.println();
    }
}


Saturday, March 3, 2018

Name Greeter in Spring Boot

I am just a beginner in Spring MVC and Spring Boot this code will show how to mapped and pass a name and display on the template webpage.  I hope you will find my work useful.

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

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

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is  +63 (034) 4335675.




Sample Program Output


Program Listing

Demoapplication.java

package com.jake.demoapp;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplicationpublic class DemoappApplication {

   public static void main(String[] args) {
      SpringApplication.run(DemoappApplication.class, args);
   }
}

GreetingController.java

package com.jake.demoapp;

/** * Created by Jacob on 3/3/2018. */
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class GreetingController {
    @RequestMapping("/greeting")
    public String greeting(@RequestParam(value = "name", required = false, defaultValue = "World !!!") String name, Model model) {
        model.addAttribute("name", name);
        return "greeting";
    }

}

greeting.html

<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>Getting Started: Serving Web Content</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<style>
    p {
        font-family: Arial;
        font-weight: bold;
        size:25px;
        color:blue;
    }
</style>
<body>
<p th:text="'Hello, ' + ${name} + '!'" />
</body>
</html>






Friday, March 2, 2018

Perfect Number in C

In this article is another simple program to show you how to solve perfect number using C language. The code is very simple and easy to understand I am using Code Blocks to write this code.

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

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

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is  +63 (034) 4335675.





Sample Program Output



Program Listing

perfect.c

#include <stdio.h>

int main()
{
    int number=0, rem=0, sum = 0, a=0;

    printf("Perfect Number in C");
    printf("\n\n");
    printf("Enter a Number : ");
    scanf("%d", &number);
    for (a = 1; a <= (number - 1); a++)
    {
        rem = (number % a);
if (rem == 0)
        {
            sum = sum + a;
        }
    }
    if (sum == number) {
        printf("\n\n");
        printf("The given number %d is perfect number.", number);
        printf("\n\n");
    }
    else {
        printf("\n\n");
        printf("The given number %d is not a perfect number.",number);
        printf("\n\n");
    }
     printf("\n\n");
    return 0;

}



Student Record System in C++

A very simple code to accept and display student profile using C++. I am using structure to hold and display it to the screen.

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

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

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is  +63 (034) 4335675.



Program Listing

struct.cpp


#include <iostream>

using namespace std;

struct new_person {
    string name,address;
    int age;
};

main() {
    new_person sample;

    cout << "Enter your name : ";
    getline(cin,sample.name);
    cout << "\nEnter your Address : ";
    getline(cin,sample.address);
    cout << "\nEnter your Age : ";
    cin >> sample.age;


    cout << "\n\nName    : " << sample.name;
    cout << "\n\nAddress : " << sample.address;
    cout << "\n\nAge     : " << sample.age;
    cout << "\n\n";
    system("pause");
}

Student Grading System Using Text File in C++

A very simple program that I wrote a long time ago to compute and store the student grade in a text file using C++. I am using Code Blocks as my text editor and Dev C++ as my C++ compiler in this program.

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

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

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is  +63 (034) 4335675.



Program Listing.

student_grade.cpp

#include <iostream>
#include <fstream>

using namespace std;

float grade(float pre, float med, float end)
{
   float compute=0;
  compute = (pre * 0.30) + (med * 0.30) + (end * 0.40);
  return(compute);
}

 main() {
      ofstream myfile("grade.txt");
      string name,course;
      float pre1=0.00, med1=0.00,end1=0.00;
      cout << "\n\t Student Grading System 1.0";
      cout << "\n\n";
      cout << "Enter Student Name    : ";
      getline(cin,name);
      cout << "Enter Student Course : ";
      getline(cin,course);
      cout << "Enter Prelim Grade    : ";
      cin >> pre1;
      cout << "Enter Midterm Grade   : ";
      cin >> med1;
      cout << "Enter Midterm Grade   : ";
      cin >> end1;
      cout << "\n\n";
      cout << "Final Grade "
           << grade(pre1,med1,end1)
           << ".";
      cout << "\n\n";
      myfile << "\n======================";
      myfile << "\n Student Grade Report ";
      myfile << "\n====================== ";
      myfile << "\n\n";
      myfile << "\nStudent Name   : " << name;
      myfile << "\nStudent Course : " << course;
      myfile << "\n\n";
      myfile << "\nPrelim  Grade   : " << pre1;
      myfile << "\nMidterm Grade   : " << med1;
      myfile << "\nEndterm Grade   : " << end1;
      myfile << "\n\n";
      myfile << "Final Grade "
           << grade(pre1,med1,end1)
           << ".";
      myfile.close();
      system("pause");
 }


Stack Function Call in C

A very simple program in C language to show how to call a function using stack.

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

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

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.




Program Listing

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

unsigned int far *ptr ;
void ( *p )( void ) ;

void f1( ) ;
void f2( ) ;

void main( )
{
f1( ) ;
f2( ) ;

printf ( "\nback to main..." ) ;
exit ( 1 ) ;
}

void f1( )
{
ptr = ( unsigned int far * ) MK_FP ( _SS, _SP + 2 ) ;
printf ( "\n%d", *ptr ) ;

p = ( void ( * )( ) ) MK_FP ( _CS, *ptr ) ;
( *p )( ) ;
printf ( "\nI am f1( ) function " ) ;
}

void f2( )
{
printf ( "\nI am f2( ) function" ) ;
}




Tuesday, February 27, 2018

Palindrome Checker in C

Here is a simple program that will ask the user to give a string and our program will check if the given string is a Palindrome or not Palindrome using C language.

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

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

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.




Sample Program Output


Program Listing

palindrome.c

#include <stdio.h>
#include <string.h>

int main()
{
   char str_name[100], b[100];

   printf("PALINDROME CHECKER IN C ");
   printf("\n\n");
   printf("Give a String : ");
   gets(str_name);

   strcpy(b,str_name);
   strrev(b);

   if (strcmp(str_name,b) == 0) {
      printf("\n\n");
      printf("The given string %s is a palindrome.\n",str_name);
      }
   else{
       printf("\n\n");
       printf("The given string %s is not a palindrome.\n",str_name);
       }
   return 0;
}




Prime Number Checker in JQuery

In this article I would like to share with you a sample program to accept a number from our user and then our program will check if the given number in a Prime Number or Not a Prime Number using JQuery.

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

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

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.




Sample Program Output


Program Listing

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js">
</script>
  <meta charset="utf-8">
  <style>
    body {
         background-color: lightgreen;
         font-family: arial;
         font-size: 15px;

    }
  </style>
  <script>
    $(document).ready(function() {
       var res = 0;
         
         var number = parseInt($("#txtnum").val());
         $("#txtnum").keypress(function(e) {

           if (e.which >= 48 && e.which <= 57) {
                
           }
           else {
             $("#error").html("Please enter only number number").show().fadeOut("slow");
             return false;
           }
         });
         $("#check").click(function() {
             res = 0;
             var number = parseInt($("#txtnum").val());
         
           for (var i = 1; i < number; i++) {
             if (number % i == 0) {
               res++;
             }
           };
             console.log(res);
           if (res >= 2) {
             $("#error").html("The given number is not a prime number.").show().fadeOut(5000);
             return false;
           }
           else {
             $("#error").html("The given number is a prime number.").show().fadeOut(5000);
           };
         });
       });
  </script>
</head>
<body>
    <table align="left">
    
    <tr>
      <td>
      </td>
      <td align="left">
          <h2>PRIME NUMBER CHECKER IN JQUERY</h2>
      </td>
      <td>
      </td>
    </tr>
    <tr>
      <td>
       Give a Number
      </td>
      <td>
        <input type="text" id="txtnum">
      </td>
      <td>
        <span id="error"> </span>
      </td>
    </tr>
    <tr>
      <td>
      </td>
      <td align="left">
         <input type="submit" value="Check Number" id="check">
      </td>
      <td>
      </td>
    </tr>
  </table>
</body>
</html>



Making Text Bold and Color Red Text in JQuery

Here is a simple code that I wrote that will make the text bold and red using JQuery. The code is very simple and easy to understand.


I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

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

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.



Sample Program Output


Program Listing

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js">
</script>
  <meta charset="utf-8">
  <script>
    $( document ).ready(function() {
      $('.ui-dialog-title').css({ 'font-weight': 'bold' });
       $('.ui-dialog-title').css({ 'color': 'red' });                          
    });
  </script>
</head>
<body>
    <div class="ui-dialog-title">
    Tonight, we dine in hell. </div>
</body>
</html>

Friday, February 23, 2018

Prime Number Checker in Visual Foxpro


A simple program that I wrote using Microsoft Visual Foxpro 9 that will ask the user to give a number and then our program will check if the given number is a Prime or Not a Prime Number. The code is very easy to understand and use.

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

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

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.




Sample Program Output


Program Listing



Object: Form1    Procedure: Init
==============

thisform.txtvalue.Value=0

Check Button
=============
Object: Command1    Procedure: Click

 IF  empty(thisform.txtvalue.Value) 
     MESSAGEBOX("Can't be empty")
     thisform.txtvalue.Value=0
     thisform.txtvalue.SetFocus
     RETURN .t.
  ENDIF
  
  
  a=0
  for i=thisform.txtvalue.value to 1 step -1
  if MOD(thisform.txtvalue.value,i)=0
  a=a+1 
  ENDIF
  endfor
 
 if a=2 AND a#1
  display_result="The given number " + transform(thisform.txtvalue.value)+" is a Prime number."
  else
   display_result="The given number " +transform(thisform.txtvalue.value)+" is not a Prime number"
  endif
  thisform.label2.Caption = display_result
  
  
Check Button
==================
Object: Command2    Procedure: Click

 thisform.label2.Caption=""
 thisform.txtvalue.Value=0
 thisform.txtvalue.setfocus

 Quit Button
==================
Object: Command3    Procedure: Click

thisform.release