Wednesday, August 3, 2022

Days of the Month Using Swing in Java

 Machine Problem

Create a program that will input a value of days and output  the corresponding number of months and number of days.  Assume that 30 days is equivalent to 1 month.

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


/* Create a program that will input a value of days and output

 * the corresponding number of months and number of days. 

 * Assume that 30 days is equivalent to 1 month.

 * 

 */


import javax.swing.JOptionPane;


public class Month {


public static void main(String[] args) {

// TODO Auto-generated method stub

// obtain user input from JOptionPane input dialogs


      String days = 


         JOptionPane.showInputDialog( "Enter number of days : " );

      

      int days_value = Integer.parseInt(days); 

      

            

      if (days_value == 28 || days_value == 29) {

        JOptionPane.showMessageDialog( null,  "Month With 28 or 29 Days " + "\nFebruary" 

        , "The Result", JOptionPane.INFORMATION_MESSAGE );

            

      } else if (days_value == 31) {

      JOptionPane.showMessageDialog( null,  "Months With 31 Days\n" + "\nJanuary\r\n"

      + "March\r\n"

      + "May\r\n"

      + "July\r\n"

      + "August\r\n"

      + "October \r\n"

      + "December" 

          , "The Result", JOptionPane.INFORMATION_MESSAGE );

      } else if (days_value == 30) {

      JOptionPane.showMessageDialog( null,  "Months With 30 Days\n" + "\nApril\r\n"

      + "June\r\n"

      + "September\r\n"

      + "November\r\n"

      , "The Result", JOptionPane.INFORMATION_MESSAGE );

      } else {

      JOptionPane.showMessageDialog( null,"Invalid Days. Try Again", 

      "The Result", JOptionPane.INFORMATION_MESSAGE );

      }


}


}




Tuesday, August 2, 2022

Simple Login Using Swing in Java

Simple Login Using Swing in Java

 A simple login program using swing 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

LoginDemo.java

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

import javax.swing.JOptionPane;


/**

 *

 * Simple Login Using Swing in Java

 *

 * @version 1.0 from 09/07/2022

 * @Jake Pomperada

 */


public class LoginDemo extends JFrame {

  /**

*/

private static final long serialVersionUID = 1L;

// start attributes

  private JLabel lblUsername = new JLabel();

  private JLabel lblPassword = new JLabel();

  private JTextField txtUSername = new JTextField();

  private JTextField txtPassword = new JTextField();

  private JButton bOK = new JButton();

  private JButton btnCancel = new JButton();

  // end attributes

  

  public LoginDemo() { 

    // Frame-Init

    super();

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    int frameWidth = 289; 

    int frameHeight = 205;

    setSize(frameWidth, frameHeight);

    Dimension d = Toolkit.getDefaultToolkit().getScreenSize();

    int x = (d.width - getSize().width) / 2;

    int y = (d.height - getSize().height) / 2;

    setLocation(x, y);

    setTitle("LoginDemo");

    setResizable(false);

    Container cp = getContentPane();

    cp.setLayout(null);

    // start components

    btnCancel.setBounds(184, 120, 83, 25);

    btnCancel.setText("Cancel");

    btnCancel.setMargin(new Insets(2, 2, 2, 2));

    btnCancel.addActionListener(new ActionListener() { 

      public void actionPerformed(ActionEvent evt) { 

        btnCancel_ActionPerformed(evt);

      }

    });

    btnCancel.setMnemonic(KeyEvent.VK_A);

    cp.add(btnCancel);

    bOK.setBounds(104, 120, 75, 25);

    bOK.setText("OK");

    bOK.setMargin(new Insets(2, 2, 2, 2));

    bOK.addActionListener(new ActionListener() { 

      public void actionPerformed(ActionEvent evt) { 

        bOK_ActionPerformed(evt);

      }

    });

    cp.add(bOK);

    txtUSername.setBounds(104, 24, 161, 25);

    cp.add(txtUSername);

    lblUsername.setBounds(8, 24, 89, 25);

    lblUsername.setText("Username");

    cp.add(lblUsername);

    

    lblPassword.setBounds(8, 72, 89, 25);

    lblPassword.setText("Password");

    cp.add(lblPassword);

    txtPassword.setBounds(104, 72, 161, 25);

    cp.add(txtPassword);

    // end components

    

    setVisible(true);

  }

  

  // start methods

  

  public static void main(String[] args) {

    new LoginDemo();

  }

  public void bOK_ActionPerformed(ActionEvent evt) {

    String userName = txtUSername.getText();

    String passWord = txtPassword.getText();

    

    if(userName.equals("admin") && passWord.equals("123"))

      JOptionPane.showMessageDialog(this, "Login successful");

    else {

      JOptionPane.showMessageDialog(this, "Login failed");

    }

    

  }


  public void btnCancel_ActionPerformed(ActionEvent evt) {

    System.exit(0);

  }

}


Monday, August 1, 2022

Exception Handling in C++

Exception Handling in C++

 A simple program that I wrote in C++ to demonstrate how to declare and use exception handling.

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

/* a program that will ask the user to input a character 
and identify if the character is not an alphabet*/

#include <iostream>

using namespace std;

int main( )
 {
char let;
cout << "Exception Handling in C++\n\n";
 
try
{
cout << "Enter a character\n";
cin >> let;
cout <<"\n\n";
let=toupper(let);
if (!isalpha(let)) 
//isalpha - is a character detection type to identify if it is a letter
  throw let ;
cout<<let<<" is an alphabet!!:";
         
}
catch(char x)
{
cout << " Exception Thrown with\n"
            <<x<< " is not an alphabet!!.\n";
}

cout<<endl<<"End of program";
}  

Sunday, July 31, 2022

How To Run JavaScript Code Using Node.JS

How To Run JavaScript Code in Node.JS

 A simple program to add the sum of two numbers using JavaScript and run on Node.JS.

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


var a = 5;  var b = 6;  

var sum =0;

var sum = (a+b);

console.log("The sum of " + a + " and " + b + " is " + sum + ".");



Saturday, July 30, 2022

Swap Two Numbers Using JOptionPane in Java

Swap Two Numbers Using JOptionaPane in Java

A simple program that I wrote that will ask the user to give two numbers and then the program will swap the arrangement 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

package demo;

import javax.swing.JOptionPane;

public class Activity_No_One {

public static void main(String[] args) {
// TODO Auto-generated method stub
// obtain user input from JOptionPane input dialogs

      String one = 

         JOptionPane.showInputDialog( "Enter first integer" );

      String two =

          JOptionPane.showInputDialog( "Enter second integer" );
      
      // convert String inputs to int values for use in a calculation

      int a = Integer.parseInt(one); 

      int b = Integer.parseInt(two);
      
      int temp=0;

      
      // display result in a JOptionPane message dialog

      JOptionPane.showMessageDialog( null,  "Value No. 1 : " + a + "\n" 
      + "Value No. 2 : " + b, "Before Swapping", JOptionPane.INFORMATION_MESSAGE );
      
      /*swapping */  
       temp = a;  
       a = b;  
       b = temp;  
       
       
       JOptionPane.showMessageDialog( null,  "Value No. 1 : " + a + "\n" 
          + "Value No. 2 :  " + b, "After Swapping", JOptionPane.INFORMATION_MESSAGE );

}

}

Friday, July 29, 2022

Removing yourself from a collaborator's repository in Github

Fever Checker in TypeScript

Fever Checker in TypeScript

 Machine Problem

Write a program that will check if the given patients temperature of 41 degrees Celsius and would display on screen if he/she has fever depending whether his/her temperature exceeds 39 degrees Celsius. If it is less than that, then the patient has normal temperature. Using if-else 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.

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


/* fever_checker.ts
   Jake Rodriguez Pomperada, MAED-IT, MIT
   www.jakerpomperada.com and www.jakerpomperada.blogspot.com
   jakerpomperada@gmail.com
   July 21, 2022    8:52 PM    Thursday
   Bacolod City, Negros Occidental
*/

var body_temp : number = 38;
var result_one : string = "";
var result_two : string = "";

// It the patients body temperature less than (<) 39
// degrees celsius then the patient does not a fever.

if (body_temp < 39) {
  result_one = "The patient's body temperature of " +body_temp + " degrees Celsius.\n";
  result_two = "You don't have a fever!\n";
} else
// It the patients body temperature greater than or equal (>=)
// degrees celsius then the patient does not a fever.
{
result_one = "The patient's body temperature of " +body_temp + " degrees Celsius.\n";
result_two = "You have a fever!\n";
}

console.log();
console.log("\tFever Checker in TypeScript\n");
console.log(result_one);
console.log(result_two);
console.log("\tEnd of Program\n");


Thursday, July 28, 2022

Numerical Table in C

Numerical Table in C

 A simple program that I wrote to generate numerical table 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 program that displays the following table using C language

p       p*5  p*10

5       25     50

10     50     100

25     125   250

50    250   500


*/

#include <stdio.h>

int main()
{
   int p[4] = {5,10,25,50};
   int a=0;
   
    printf("\n\n");
    printf("Numerical Table in C\n\n");

    printf("p\tp*5\tp*10\n\n");

    for (a=0; a<4; a++) {
printf(" %d \t  %d \t  %d\n",p[a],a[p]*5,a[p]*10);
}
}

Numerical Table in C++