Thursday, October 21, 2021

Print 1 To 15 Using For Loop in C++

  Machine Problem

   Write a C++ program that will print 1 to 15 numbers    in the screen using for loop statement.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.




Program Listing

/*
* for.cpp
* Prof. Jake Rodriguez Pomperada, MAED-IT, MIT
* www.jakerpomperada.com and  www.jakerpomperada.blogspot.com
* jakerpomperada@gmail.com
* Bacolod City, Negros Occidental Philippines

   Machine Problem

   Write a C++ program that will print 1 to 15 numbers
   in the screen using for loop statement.

*/

#include <iostream>


int main()
{

   std::cout <<"\n\n";
   std::cout << "\tPrint 1 To 15 Using For Loop in C++";
   std::cout <<"\n\n";
   std::cout <<"\t";
    for (int a=1; a<=15; a++) {
         std::cout <<" " << a << " ";
    }
   std::cout <<"\n\n";
   std::cout << "\tEnd of Program";
   std::cout <<"\n\n";
}


Wednesday, October 20, 2021

How to Compile and Run Java Program in Sublime

Selection Sort in Java

Selection Sort in Java

 Machine Problem

 Write a Java program that will perform selection sort algorithm by asking the user to give a number and then it is display the original arrangement of numbers, and its sorted values.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





Program Listing

package test;

import java.util.Scanner;  

/*
 * Selection_Sort.java
 * 
 * Jake Rodriguez Pomperada, MAED-IT, MIT
 * www.jakerpomperada.com  and www.jakerpomperada.blogspot.com
 * jakerpomperada@gmail.com
 * Bacolod City, Negros Occidental Philippines
 * 
 * Machine Problem
 * 
 * Write a Java program that will perform selection sort algorithm by
 * asking the user to give a number and then it is display the original
 * arrangement of numbers, and its sorted values.
 * 
 */

public class Selection_Sort {
  public static void main(String args[])  
   {  
       int size, i, j, temp;  
       int arr[] = new int[50];  
       
       @SuppressWarnings("resource")
Scanner scan = new Scanner(System.in);  
       
       System.out.println();
       System.out.println("\tSelection Sort in Java");
       System.out.println();
         
       System.out.print("Enter Array Size : ");  
       size = scan.nextInt();  
         
       
       for(i=0; i<size; i++)  
       {  
       System.out.print("Enter Element Value No." + (i+1) + ": "); 
       arr[i] = scan.nextInt();  
       }  
         
       System.out.println();
       System.out.print("UnSorted Array Values : \n");  
       System.out.println();
       for(i=0; i<size; i++)  
       {  
           System.out.print(arr[i]+ "  ");  
       }  
       
       System.out.println();
         for(i=0; i<size; i++)  
       {  
           for(j=i+1; j<size; j++)  
           {  
               if(arr[i] > arr[j])  
               {  
                   temp = arr[i];  
                   arr[i] = arr[j];  
                   arr[j] = temp;  
               }  
           }  
       }  
         
       System.out.println();
       System.out.print("Sorted Array Values : \n");  
       System.out.println();
       for(i=0; i<size; i++)  
       {  
           System.out.print(arr[i]+ "  ");  
       }  
       
       System.out.println("\n\n");
       System.out.print("End of Program \n");  
       System.out.println();
       scan.close();
   }  
}  

Tuesday, October 19, 2021

Calculator Using Switch Statement in Java

Calculator Using Switch Statement in Java

 Machine Problem

 Write a Java program that will use the MDAS Operation to  * calculate integers. "Use switch Statement" using Java programming language.

  Sample Program Output

  Operator (+,-,*,/)

 Choose Operator : +

  Enter First Number: 10

  Enter Second Number: 1

  10 + 1 = 11

  Operator (+,-,*,/)

 Choose Operator : -

  Enter First Number: 10

  Enter Second Number: 1

  10 - 1 = 9

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





Program Listing

package test;


import java.util.Scanner;



/*

 * Calculator.java

 * 

 * Jake Rodriguez Pomperada, MAED-IT, MIT

 * www.jakerpomperada.com  and www.jakerpomperada.blogspot.com

 * jakerpomperada@gmail.com

 * Bacolod City, Negros Occidental Philippines

 * 

 * Machine Problem

 * 

 * Write a Java program that will use the MDAS Operation to

 * calculate integers. "Use switch Statement"

 * 

 * Sample Program Output

 * 

 * Operator (+,-,*,/)

 * Choose Operator : +

 * Enter First Number: 10

 * Enter Second Number: 1

 * 10 + 1 = 11

 * 

 * Operator (+,-,*,/)

 * Choose Operator : -

 * Enter First Number: 10

 * Enter Second Number: 1

 * 10 - 1 = 9

 */


public class Calculator {

public static void main(String[] args) {


char operator;

    int number1, number2, result;


    // create an object of Scanner class

    Scanner input = new Scanner(System.in);


    // ask users to enter operator

    System.out.println();

    System.out.println("+,=,*,/");

    System.out.print("Choose Operator : ");

    operator = input.next().charAt(0);


    // ask users to enter numbers

    System.out.print("Enter First Number : ");

    number1 = input.nextInt();


    System.out.print("Enter Second Number : ");

    number2 = input.nextInt();


    switch (operator) {


      // performs addition between numbers

      case '+':

        result = number1 + number2;

        System.out.println(number1 + " + " + number2 + " = " + result);

        break;


      // performs subtraction between numbers

      case '-':

        result = number1 - number2;

        System.out.println(number1 + " - " + number2 + " = " + result);

        break;


      // performs multiplication between numbers

      case '*':

        result = number1 * number2;

        System.out.println(number1 + " * " + number2 + " = " + result);

        break;


      // performs division between numbers

      case '/':

        result = number1 / number2;

        System.out.println(number1 + " / " + number2 + " = " + result);

        break;


      default:

        System.out.println("Invalid operator!");

        break;

    }


    input.close();

  }

}



Reverse A String in C

Reserve a String in C

 A simple program that will ask the user to give a string and then the program will display the original string and the reverse string on the screen using C programming language.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.






Program Listing

#include <stdio.h>

#include <string.h>

 

void reverse_string(char *given_str)

{

    int a=0,temp=0,n=0;

     n=strlen(given_str);

for(a=0;a<n/2;a++)  

    {

    temp=given_str[a];

    given_str[a]=given_str[n-a-1];

    given_str[n-a-1]=temp;

 

  }

  

 }

int main()

{

 

    char str[2000];  

   

    printf("\n\n");

    printf("\tReverse a String in C");

    printf("\n\n");

    printf("\tGive a String: ");

    gets(str);

    

    printf("\n\n");

    printf("\tBefore String Reverse : %s\n",str);

 

    reverse_string(str);

    

printf("\n\n");

    printf("\tAfter String Reverse  : %s\n",str);

    printf("\n\n");

    printf("\tEnd of Program");

    printf("\n\n");

    

     

     

}


Monday, October 18, 2021

Ternary Operator in Java

Ternary Operator in Java

 A simple program to demonstrate how to declare and use the ternary operator in Java programming language.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





Program Listing


package test;


public class Ternary_Operator {


public static void main(String[] args) {

// TODO Auto-generated method stub

int a=1500; int b=1300;

String display_result = (a>b) ? "orange" : "grapes";

System.out.println();

System.out.print("\tTernary Operator in Java");

System.out.println("\n");

System.out.print ("\tThe Result is " + display_result + ".");

System.out.println();



}


}


Sunday, October 17, 2021

Count Lower Case Letters in Java

Count Lower Case Letters in Java

 Machine Problem

Write a Java program to ask the user a string and then the program will count the number    of lowercase letters in the given string by user.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.



Program Listing


/*

 *  LowerCase.java

 *  

 *  Jake Rodriguez Pomperada, MAED-IT, MIT

 *  www.jakerpomperada.blogspot.com and www.jakerpomperada.com

 *  jakerpomperada@gmail.com

 *  Bacolod City, Negros Occidental Philippines

 * 

 * Machine Problem

 * 

 * Write a Java program to ask the user a string and then the program will count the number

 * of lowercase letters in the given string by user.

 */


import java.util.Scanner;


 

public class LowerCase_Letters {

    

    

    private static long countLowerCase(String s) {

    return s.codePoints().filter(c-> c>='a' && c<='z').count();

}

    

 public static void main(String[] args) {

     

  Scanner input = new Scanner(System.in);

   

  System.out.println();

  System.out.println("\tCount Lower Case Letters in Java");

  System.out.println();

  

  System.out.print("\tEnter a String : ");

  String val_str = input.nextLine();

  

  long count_LowerCase = countLowerCase(val_str);

  

  System.out.println();

  System.out.print("\tNumber of Lowercase Letters : " + count_LowerCase);

  System.out.println("\n\n");

  System.out.println("\tEnd of Program");

  System.out.println();

 }

 

}


Count Capital Letters in Java

Count Capital Letters in Java

 Machine Problem

Write a Java program to ask the user a string and then the program will count the number  of capital letters in the given string by user.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.




Program Listing


/*

 *  Capital_Letters.java

 *  

 *  Jake Rodriguez Pomperada, MAED-IT, MIT

 *  www.jakerpomperada.blogspot.com and www.jakerpomperada.com

 *  jakerpomperada@gmail.com

 *  Bacolod City, Negros Occidental Philippines

 * 

 * Machine Problem

 * 

 * Write a Java program to ask the user a string and then the program will count the number

 * of capital letters in the given string by user.

 */


import java.util.Scanner;


 

public class Capital_Letters {

    

    private static long countUpperCase(String s) {

    return s.codePoints().filter(c-> c>='A' && c<='Z').count();

}

    

 public static void main(String[] args) {

     

  Scanner input = new Scanner(System.in);

   

  System.out.println();

  System.out.println("\tCount Capital Letters in Java");

  System.out.println();

  

  System.out.print("\tEnter a String : ");

  String val_str = input.nextLine();

  

  long count_Capital = countUpperCase(val_str);

  

  System.out.println();

  System.out.print("\tNumber of Capital Letters : " + count_Capital);

  System.out.println("\n\n");

  System.out.println("\tEnd of Program");

  System.out.println();

 }

 

}


Saturday, October 16, 2021

Basic Math Program in AngularJS

Basic Math Program in AngularJS

 Machine Problem

Write a program that will ask the user to give two numbers and then the program will compute the sum, difference, product, and quotient of the two given numbers by the user and display the results on the screen using AngularJS.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





Program Listing

<!-- index.htm

  Author   : Prof. Jake Rodriguez Pomperada, MAED-IT, MIT

  Date     : July 24, 2021  Saturday 10:30 PM

  Place    : Bacolod City, Negros Occidental

  Websites : www.jakerpomperada.com and www.jakerpomperada.blogspot.com

  Email    : jakerpomperada@gmail.com

 -->

<html>

  <head>

    <title>Basic Math Program in AngularJS</title>

  <script type="text/javascript" src="angular.min.js"></script>

     

 </head>

 <style>

body {

font-family: arial;

font-size: 25px;

font-weight: bold;

}

</style>

 <body ng-app="">

  <h3>Basic Math Program in AngularJS</h3>

 <div>

  <table border="0">

  <tr>

  <td>

  Enter First Value </td>

       <td>

        &nbsp;&nbsp;&nbsp;&nbsp;

         <input type="number"  size="10" ng-model="val_1" required/>

       </td>

     </tr>

       <tr>

        <td>

      Enter Second Value </td>

       <td>

        &nbsp;&nbsp;&nbsp;&nbsp;

         <input type="number"  size="10" ng-model="val_2" required/>

       </td>

     </tr>

       <tr>

        <td>&nbsp;&nbsp;&nbsp;</td>

      </tr>

       </table>

       The sum of {{val_1}} and {{val_2}} is {{val_1+val_2}}.<br>

       The difference between {{val_1}} and {{val_2}} is {{val_1-val_2}}.<br>

       The product between {{val_1}} and {{val_2}} is {{val_1*val_2}}.<br>

       The quotient between {{val_1}} and {{val_2}} is {{(val_1/val_2) | number:0}}.<br>

       <br>

    </div><br>

       </div>

    </body>

</html>