Monday, June 20, 2022

Sum of Digits in C

 A simple program to ask the user to give a number and then the program will compute the sum of digits 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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.




Program Listing

/* Write a C program to Find Sum of Digits 

of a given number */



#include <stdio.h>


int main()

{

    int num=0, sum = 0;

 

    printf("\n\n");

    printf("\tSum of Digits in C\n");

    printf("\n\n");

    printf("\tGive a Number : ");

    scanf("%d",&num);

printf("\n\n");

    printf("\tThe given number %d.\n\n",num);


    //loop to find sum of digits

    while(num!=0){

        sum += num % 10;

        num = num / 10;

    }

 

    printf("\tThe sum of digits %d.\n",sum);

    printf("\n");

    printf("\tEnd of Program");

    printf("\n");

    return 0;


}

Sunday, June 19, 2022

Grade Solver Using Pointers in C++

Grade Solver Using Pointers in C++

 A simple program that I wrote to solve the grade of the student using struct and pointers in 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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.




Program Listing

#include <iostream> 

#include <string>

#include <iomanip>

using namespace std;

struct student {
    string name;
    int age;
    float prelim,midterm,endterm;
};


float compute_grade(float *prelim,
                   float *midterm,
                   float *endterm)
{
  float solve=0.00;
  string remarks;

  solve = (*prelim * 0.30) +
          (*midterm * 0.30) +
          (*endterm * 0.40);

 if (solve >= 75.00)  {
     remarks = "PASSED";
 }
 else {
     remarks = "FAILED";
 }

 cout << fixed;
 cout << setprecision(0);
 cout << "\n\nThe student grade is " << solve
    << setw(10) << "Remarks: " <<setw(3)
    << remarks << ".";
 return(solve);
}


 int main() {


     student user;
     float *mypointer;

     cout << "\n\n";
     cout << "\t\tGrade Solver Using Pointers in C++";
     cout << "\n\n";
     cout << "\t Created By: Mr. Jake R. Pomperada, MAED-IT, MIT";
     cout << "\n\n";
     cout << "Enter the Name of the Student :";
     getline(cin,user.name);
      cout << "\n";
     cout << "Enter the Age of the Student  :";
     cin >> user.age;
     cout << "\n";
     cout << "Enter the Prelim Grade :";
     cin >> user.prelim;
     mypointer = &user.prelim;
     cout << "\n";
     cout << "Enter the Midterm Grade :";
     cin >> user.midterm;
     mypointer = &user.midterm;
     cout << "\n";
     cout << "Enter the Endterm Grade :";
     cin >> user.endterm;
     mypointer = &user.endterm;
     cout << "\n\n";
     cout << "\t ===== GENERATED REPORT =====";
     cout << "\n\n";
     cout << "\nStudent Name : " << user.name;
     cout << "\nStudent Age  : " << user.age;
     compute_grade(&user.prelim,&user.midterm,&user.endterm);


     cout << "\n\n";

     system("pause");
 }



Saturday, June 18, 2022

Odd and Even Numbers Using JOptionPane in Java

Odd and Even Number Using JOptionPane Using Java

 A program that I wrote will ask the user to give a number and then the program will check if the given number is odd or even using JOptionPane using 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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.






Program Listing


import javax.swing.JOptionPane;

/*  Jake Rodriguez Pomperada, MAED-IT, MIT
 *  www.jakerpomperada.com and www.jakerpomperada.blogspot.com
 *  jakerpomperada@gmail.com
 */

public class Odd_Even_Numbers {

public static void main(String[] args) {
// TODO Auto-generated method stub
int number;
        number = Integer.parseInt(JOptionPane.showInputDialog("Give a Number "));
        
        if(number%2==0)

        JOptionPane.showMessageDialog( null, "The given number "  + number + " is even number.",

           "The Result", JOptionPane.INFORMATION_MESSAGE );
        else
           JOptionPane.showMessageDialog( null, "The given number "  + number + " is odd number.",

                 "The Result", JOptionPane.INFORMATION_MESSAGE );
}

}


Friday, June 17, 2022

Addition and Product of Two Numbers Using JOptionPane in Java

A simple program to ask the user to give two numbers and then the program will compute the sum and product of two numbers using JOptionPane 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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.





Program Listing

/* Jake Rodriguez Pomperada, MAED-IT, MIT

 * jakerpomperada@gmail.com

 * 

 */


import javax.swing.JOptionPane;


public class add_product {


public static void main(String[] args) {

// TODO Auto-generated method stub

// obtain user input from JOptionPane input dialogs


      String one = 


         JOptionPane.showInputDialog( "Enter first value" );


      String two =


          JOptionPane.showInputDialog( "Enter second value" );

      

      // convert String inputs to int values for use in a calculation


      int a = Integer.parseInt(one); 


      int b = Integer.parseInt(two);

      

      int sum = (a+b);

      int product = (a*b);


      

      // display result in a JOptionPane message dialog


      JOptionPane.showMessageDialog( null,  "The Sum : " +  sum + "\n" 

      + "The Product: " + product, "The Result", JOptionPane.INFORMATION_MESSAGE );

      

    

       

       

      

}


}


Thursday, June 16, 2022

Addition of Three Numbers Using Functions in C++

Addition of Three Numbers Using Functions in C++

 A simple program to ask the user to give three numbers and then the program will compute the sum of three numbers using a function in 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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.




Program Listing

#include <iostream>

using namespace std;

int add_three_numbers(int x, int y, int c)
{
    return(x+y+c);
}

int main(){
   int a=0,b=0,c=0;
   int sum=0;

   cout <<"\n\n";
   cout << "\tAddition of Three Numbers Using Functions in C++";
   cout <<"\n\n";
   cout << "\tEnter Three Numbers : ";
   cin >> a >> b >> c;
   sum = add_three_numbers(a,b,c);
   cout <<"\n\n";
   cout << "\tThe sum of " << a << ", " << b << " and "
        << c << " is " << sum << ".";
   cout <<"\n\n";
   cout <<"\tEnd of Program";
   cout <<"\n\n";
}



How To Write and Run a C++ Program in CodeBlocks

Tuesday, June 14, 2022

Addition of Two Numbers in TypeScript

 A simple program that I wrote while learning typescript to add the sum of the two given numbers using a typescript 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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.






Program Listing

add.ts



var a=10;
var b = 20;

var sum = (a+b);

console.log("Addition of Two Numbers in TypeScript\n");
console.log("The sum of " + a + " and " + b + " is " + sum + ".\n");
console.log("End of Program");

Employee's Record System Using Text File in Java

Employee's Record System in Java Using Text File

 A simple database application that I wrote using a Text file in Java programming language that I called employee's record system demonstrates the concepts of CRUD (Create, Read, Update, and Delete) in the database management system.

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.

Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

=================================================


Want to support my channel?

GCash Account

Jake Pomperada

09173084360


Paypal

https://paypal.me/jakerpomperada


Patreon

https://www.patreon.com/jakerpomperada


Thank you very much for your support.







Program Listing


Main.java


/* Main.java
Author : Jake Rodriguez Pomperada, MAED-IT, MIT
Date : June 12, 2022 Sunday 11:32 AM
Tool : Java SDK, Employee's Record System in Java
Website: www.jakerpomperada.com and www.jakerpomperada.blogspot.com
Email : jakerpomperada@gmail.com
Bacolod City, Negros Occidental Philippines
*/

package com.company;

import java.io.*;
import java.util.ArrayList;
import java.util.Scanner;


public class Main {

public static String filename="database.txt";


// main method
public static void main(String[] args) {


createNewFileWithHeaders();
displayServices();


}

// methods

public static void createNewFileWithHeaders(){
File database=new File(filename);

try {

if( database.createNewFile()==true){

try {
FileWriter writer=new FileWriter(filename,true);
writer.append("User ID"+","+"User Name"+","+","+"Job"+","+"Address");
writer.append("\n");
writer.close();
System.out.println("file created succefully!");
} catch (IOException e) {
System.out.println(e);
}

}
else {

}

} catch (IOException e) {
e.printStackTrace();
}
}

public static void createAddNewPerson( Scanner input){
System.out.println("Enter Employee's ID : ");
String id=input.next();
System.out.println("Enter your name :");
String name=input.next();
System.out.println("Enter your job : ");
String job=input.next();
System.out.println("Enter your address");
String address=input.next();
Person person=new Person(id,name,job,address);

try {
FileWriter writer=new FileWriter(filename,true);
writer.append(person.getUserData());
writer.append("\n");
writer.close();
System.out.println("person added succefully!");
} catch (IOException e) {
System.out.println(e);
}

}

public static void deleteRecordById(ArrayList<String> arrayList,Scanner input){
System.out.println("enter any id or word to delete a record");
String searchKey=input.next();
String line;
try {

BufferedReader reader=new BufferedReader(new FileReader(filename));
while ((line=reader.readLine())!=null){
if(line.contains(searchKey)){
System.out.println(line);
continue;
}else {
arrayList.add(line);
}



}

}catch (Exception e){

}
try {
FileWriter writer=new FileWriter(filename);
for (int i=0;i<arrayList.size();i++){
writer.append( arrayList.get(i));
writer.append("\n");


}
writer.close();

}catch (Exception e){
System.out.println(e);
}finally {
System.out.println("done!");
}}

public static void updateRecord(ArrayList<String>arrayList,Scanner input){
try {
BufferedReader reader=new BufferedReader(new FileReader(filename));
System.out.println("please enter any key to update the record");
String searchKey=input.next();
String line;
while ((line=reader.readLine())!=null){
if( line.contains(searchKey)){
System.out.println("enter the text you want to change");
String oldValue=input.next();
System.out.println("enter the new text you want to change");
String newValue=input.next();
arrayList.add(line.replace(oldValue,newValue));


}else {
arrayList.add(line);
}

}


}catch (Exception e){
System.out.println(e);
}

try {
FileWriter writer=new FileWriter(filename);
for(int i=0;i<arrayList.size();i++){
writer.append(arrayList.get(i));
writer.append("\n");
}
writer.close();
}catch (Exception e){
System.out.println(e);
}

}
public static void getUserById(Scanner input){
try {
BufferedReader reader=new BufferedReader(new FileReader(filename));
System.out.println("please enter any key to get the record");
String searchKey=input.next();
String line;
while ((line=reader.readLine())!=null){
if( line.contains(searchKey)){
System.out.println(line);

}

}


}catch (Exception e){
System.out.println(e);
}


}
public static void getAllPersons(){

try {
BufferedReader reader=new BufferedReader(new FileReader(filename));


String line;
while ((line=reader.readLine())!=null){

System.out.println(line);

}

}catch (Exception e){
System.out.println(e);
}





}



public static void displayServices(){
Scanner input = new Scanner(System.in).useDelimiter("\n");

while(true){
ArrayList<String> arrayList=new ArrayList<String>();

System.out.println("====================================================");
System.out.println("Employee's Record System in Java Using Text File" +
"");
System.out.println("====================================================");
System.out.println("[1] Add New Employees Record");
System.out.println("[2] Delete Employees Record");
System.out.println("[3] Update Employees Record");
System.out.println("[4] View Employees Record");
System.out.println("[5] Quit Program");
System.out.println("====================================================");
System.out.print("Select a Number : ");
int x= input.nextInt();
if(x==5) {
System.out.println();
System.out.print("Thank you for using this program.");
System.out.println();
break;
}
else if(x==1){
createAddNewPerson(input);
}
else if(x==2){

deleteRecordById(arrayList,input);
}
else if(x==3){
updateRecord(arrayList,input);
}
else if(x==4){
getUserById(input);

}
else {
System.out.println("please enter a vaild number");
}




}
}





}

Person.java
/* Main.java
Author : Jake Rodriguez Pomperada, MAED-IT, MIT
Date : June 12, 2022 Sunday 11:32 AM
Tool : Java SDK, Employee's Record System in Java
Website: www.jakerpomperada.com and www.jakerpomperada.blogspot.com
Email : jakerpomperada@gmail.com
Bacolod City, Negros Occidental Philippines
*/

package com.company;

public class Person {
// attributes
public String id;
public String name;
public String job;
public String address;

Person(String id , String name,String job, String address){
this.id=id;
this.name=name;
this.job=job;
this.address=address;

}

public String getUserData(){

return id+"," + name +"," + ","+job+"," +address;
}


// methods



}

database.txt
567,Jacob Samuel F. Pomperada,,Data Scientist,Eroreco, Bacolod City, Negros Occidental
8912,Lydia R. Pomperada,,Social Science Teacher,Alijis, Bacolod City, Negros Occidental
345,Virgilio V. Pomperada,,Agriculture Teacher,Alijis, Bacolod City, Negros Occidental
983,Leslie Vinky P. Pepito,,Electronics Engineer,Alijis, Bacolod City, Negros Occidental