Saturday, October 23, 2021

Print 1 To 10 Using For Loop in Python

 Machine Problem

 Write a Python program to print numbers from 1 to 10 using a for loop.

  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

# print_1_To_10.py
# Prof. Jake Rodriguez Pomperada, MAED-IT, MIT
# www.jakerpomperada.blogspot.com and www.jakerpomperada.com
# jakerpomperada@gmail.com
#
# Machine Problem
# Write a Python program to print numbers from 1 to 10 using a for loop.

print()
print("\tPrint 1 To 10 Using For Loop in Python")
print()
for a in range(1, 11):
print("\t",a, end=' ')
print("\n")
print("\tEnd of Program")
print()

Friday, October 22, 2021

Print 1 To 100 Using For Loop in Java

Print 1 to 100 Using For Loop in Java

 A simple program that I wrote using Java programming to display numbers from 1 to  100 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

package test;

public class Print_1_T_100 {

public static void main(String[] args) {
// TODO Auto-generated method stub
        int counter=0;
  System.out.println("\n");
      System.out.println("\tPrint 1 To 100 Using For Loop in Java");
      System.out.println();
      System.out.print("\t");
      for (int a=1; a<=100; a+=1) {

          counter++;

         System.out.print("" + a +" ,");

        

         if(counter == 25){

             

          System.out.print("\n\t");

          counter = 0;

      }

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

}

Test Score Grade Equivalent in Java

Test Score Grade Equivalent in Java

 Machine Problem

 Write a program that will ask the user to give test score,   and then the program will convert the given test score into  grade numerical equivalent, display the results on the screen.

  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;

/* grade.java

 * 

 * 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 program that will ask the user to give test score, 

 * and then the program will convert the given test score into

 * grade numerical equivalent, display the results on the screen.

 * 

 */

import java.util.Scanner;


public class grade {

   public static void main(String[] args)

   {

      double  score;    // To hold a test score

      double grade;    


      // Create a Scanner object to read input.

      Scanner console = new Scanner(System.in);


      

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

      System.out.println("\tTest Score Grade Equivalent in Java");

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

      // Get the test score.

      System.out.print("\tEnter your numeric test score : ");

      score = console.nextDouble();


      // Calculate the grade.

 if (score >=98)

      {

         grade = 1.00;

      }

      else if (score >=95)

      {

         grade = 1.25;

      }

      else if (score >=94)

      {

         grade = 1.50;

      }

      else if (score >= 90)

      {

         grade = 1.75;

      }

      else if(score>=87)

      {

         grade = 2.00;

      }

      else if(score>=84)

      {

         grade =2.25;

      }

      else if(score>=81)

      {

         grade = 2.50;

      }

      else if(score>=76 &&  score <= 78)

      {

          grade =2.75;

      }

      else 

      {

           grade =3.00;

      }

      // Display the grade.

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

      System.out.println("\tYour grade is " + grade);

      console.close();

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

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

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

   }

 }


Thursday, October 21, 2021

Computer Parts Input and Output Devices

Print 1 To 15 Using For Loop in C++

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();



}


}