Sunday, June 30, 2019

Convert Seconds into days, hours, minutes and seconds in Java


Write a program that will ask the user to give a number in the integer (seconds) and convert it into days, hours, minutes and seconds and display it on the screen.

If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

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 in 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.

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

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing

package seconds;

import java.util.Scanner;
/**
 * Seconds.java
 * @author Jake Rodriguez Pomperada,MAED-IT
 * February 18, 2019  Sunday
 * http://www.jakerpomperada.com
 * jakerpomperada@gmail.com 
 * Bacolod City, Negros Occidental
 */
public class Seconds {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        int n=0;
        System.out.println();
        System.out.print("\tConvert Seconds into days, hours, minutes and seconds");
        System.out.println("\n");
        System.out.print("\tGive Value in Seconds : ");
        n=input.nextInt();
        int day = n / (24 * 3600); 
        n = n % (24 * 3600); 
        int hour = n / 3600; 
        n %= 3600; 
        int minutes = n / 60 ; 
        n %= 60; 
        int seconds = n; 
        System.out.println();
        System.out.println("\tIt will be " +day + " " + "day(s) " + hour  
                           + " " + "hour(s) " + minutes + " "
                           + "minute(s) " + seconds + " "
                           + "seconds."); 
        System.out.println();
        System.out.print("\tEnd of Program");
        System.out.println("\n");
    }
}

Swapping of Two Numbers Using Java


Write a program to accept two numbers and then swap two numbers with and without
using the third variable and display the result on the screen.

If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

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 in 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.

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

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing

package swap_numbers;

import java.util.Scanner;

/**
 * Swap_Numbers.java
 * @author Jake Rodriguez Pomperada,MAED-IT
 * February 17, 2019  Sunday
 * http://www.jakerpomperada.com
 * jakerpomperada@gmail.com 
 * Bacolod City, Negros Occidental
 */
 
public class Swap_Numbers {
    public static void main(String[] args) {
    
    Scanner input=new Scanner(System.in);

    int a=0,b=0;
int temp=0;
    System.out.println();
    System.out.print("\tSwap of Two Numbers");
System.out.println("\n");
    System.out.print("\tEnter First Value  : ");
a=input.nextInt();
System.out.print("\tEnter Second Value : ");
b=input.nextInt();
    System.out.println();
System.out.println("\tBefore swapping - a: "+ a +", b: " + b);
temp=a;
a=b;
b=temp;
System.out.println();
System.out.println("\tAfter swapping  - a: "+ a +", b: " + b);
    System.out.println();
    System.out.print("\tEnd of Program");
    System.out.println("\n");
    }
 }

Addition of Three Numbers Using Java

In this article, I would like to share with you a sample program to ask the user to give three numbers and then the program will compute its sum and display the results on the screen.

This program will convert a temperature from Fahrenheit to Celsius using Java programming language.

Write a program that will ask the user to give the temperature in  Fahrenheit and the program will convert the given temperature in Celsius and display the result on the screen.


If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

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 in 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.

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

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing

package addition_numbers;

import java.util.Scanner;
/**
 * Addition_Numbers.java
 * @author Jake Rodriguez Pomperada,MAED-IT
 * February 17, 2019  Sunday
 * http://www.jakerpomperada.com
 * jakerpomperada@gmail.com 
 * Bacolod City, Negros Occidental
 */
public class Addition_Numbers {
      public static void main(String[] args) {
          
      int a=0,b=0,c=0;
      int sum = 0;
     
      Scanner in = new Scanner(System.in);
      System.out.println();
      System.out.print("\t\tAddition of Three Numbers");
      System.out.println("\n");
      System.out.print("\tEnter First Value : ");
      a = in.nextInt();
      System.out.print("\tEnter Second Value : ");
      b = in.nextInt();
      System.out.print("\tEnter Third Value : ");
      c = in.nextInt();
      
      sum=(a+b+c);
      
      System.out.println();
      System.out.print("\tThe sum of " + a 
       + ","+b+" and "+ c + " is " + sum +".");
      System.out.println("\n");
      System.out.print("\tEnd of Program");
      System.out.println("\n");
        
    }
    
}



Fahrenheit to Celsius in Java

A program that I wrote for my book Introduction to Java Programming that is exclusively published by Mindshapers Inc. here is the website of my publisher https://mindshaperspublishing.com/

This program will convert a temperature from Fahrenheit to Celsius using Java programming language.

Write a program that will ask the user to give the temperature in  Fahrenheit and the program will convert the given temperature in Celsius and display the result on the screen.


If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

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 in 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.

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

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing

package temperature_converter;
/**
 * Addition_Numbers.java
 * @author Jake Rodriguez Pomperada,MAED-IT
 * February 17, 2019  Sunday
 * http://www.jakerpomperada.com
 * jakerpomperada@gmail.com 
 * Bacolod City, Negros Occidental
 */
import java.util.*;
import java.text.DecimalFormat;

public class Temperature_Converter {
     public static void main(String[] args) {
        double  temperature;
        double  display;
         Scanner in = new Scanner(System.in);
        DecimalFormat df = new DecimalFormat("#.##"); 
        System.out.println();
        System.out.print("\t\tTemperature Converter");
        System.out.println("\n");
        System.out.print("\tGive temperature in Fahrenheit : ");
        temperature = in.nextInt();
        temperature = ((temperature - 32)*5)/9;
        display = Double.valueOf(df.format(temperature));
        System.out.println();
        System.out.print("\tThe temperature in Celsius = " + display+"\u00B0C");
        System.out.println("\n");
        System.out.print("\tEnd of Program");
        System.out.println("\n");
   }
    
}



Product Solver in JavaScript

Here is a simple program that I wrote using JavaScript to ask the user to give two numbers and then it will convert it to its product equivalent. I convert my code into a mobile application using Adobe Cordova which can be installed in any Android devices such as Smart Phones and Android Tablets. I hope you will find my work useful.

If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

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 in 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.

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

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com



Program Listing

<!-- Jake R. Pomperada  -->
<!-- May 3, 2019  -->
<!-- Bacolod City, Philippines -->
<!DOCTYPE html>
<html>
<head>
    <title>Product Solver</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.css" />
    <script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>

</head>

<body>
 <script type="text/javascript">
     
     function Product() {
    var v1 = document.getElementById('txtNum1').value;
    var v2 = document.getElementById('txtNum2').value;
    if (v1 == "" || v2 == "") {
        alert('Both Values Required');
    } else {
        document.getElementById('lblResult').innerText = (Number(v1) * Number(v2));
    }
}

function Clear_All() {
     document.getElementById('txtNum1').value="";
     document.getElementById('txtNum2').value="";
     document.getElementById('lblResult').innerText="";
     document.getElementById('txtNum1').focus();
}
  </script>
    <div data-role="page">

        <div data-role="header">
            <h4>Product Solver</h4>
            <p align="center">Created By <b>Jake R. Pomperada </b></p>
        </div>
        <!-- /header -->

        <div data-role="content">
     
            <label for="txtNum1">First Value </label>
            <input id="txtNum1" name="txtNum1" type="text" value="" />
            <label for="txtNum2">Second Value </label>
            <input id="txtNum2" name="txtNum2" type="text" value="" /> <a data-inline="true" data-role="button"  onclick="Product();">Product</a>
            <a data-inline="true" data-role="button"  onclick="Clear_All();">Clear</a>
             &nbsp&nbsp Result : <label id="lblResult"></label>

        </div>
        <!-- /content -->

        <div data-role="footer">
            <h4>Servo Software Bacolod City  2019</h4>
        </div>


    </div>
    <!-- /page -->

</body>

</html>


Legal Age Program Using Ternary Operator in Ruby

Design a program that will ask the user to give their age the program check if the age of the user is still a minor or already an adult using the ternary operator. The legal age here in the Philippines is 18 years old and above.

If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

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 in 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.

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

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing

# legal.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : June 7, 2019   Friday  4:51 AM
# Address  : Bacolod City, Negros Occidental
# Tools    : Eclipse IDE and Ruby Version 2.6.3
# Location : Bacolod City, Negros Occidental  
# Website  : http://www.jakerpomperada.com
# Emails   : jakerpomperada@gmai.com and jakerpomperada@yahoo.com

puts "\n\n"
print "\tLegal Age Program Using Ternary Operator";
puts "\n\n"
print "\tTell me your name? ";
name = gets.chomp;
print "\tWhat is your age? ";
age = gets.chomp;
age = age.to_i;
puts("\n");
print "\t===== DISPLAY RESULT ====="
print "\n\n";

display_result = (age >= 18) ? "You are already an ADULT." : "You are still a MINOR." ; 

print("\tHello #{name.upcase}.\n");
print("\tAt the age of #{age} years old.\n\n")
print("\t#{display_result}");
print("\n\n");
print "\tEND OF PROGRAM";
print "\n\n";
 
 

Cube Numbers Using Until Loop Using Ruby

Here is a program that will ask the user a number and then it will list down the cube number equivalent using until loop statement in Ruby.

If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

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 in 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.

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

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing

# cube.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : June 16, 2019   Sunday 8:59 PM
# Address  : Bacolod City, Negros Occidental
# Tools    : Eclipse IDE and Ruby Version 2.6.3
# Location : Bacolod City, Negros Occidental  
# Website  : http://www.jakerpomperada.com
# Emails   : jakerpomperada@gmai.com and jakerpomperada@yahoo.com
puts "\n\n"
print "\tCube Numbers Using Until Loop ";
puts "\n\n"
print("\t");

print("Give a number : ");   
num_val = gets.chomp   
num_val = num_val.to_i;

print("\n");
print("\tNumber \t Cube Number Equivalent");
print("\n\n");
index = 1;
until index >= num_val+1 
     print("\t");
     print(" #{index} \t\t  #{index**3}\n")
  index += 1;
end
print "\n";
print "\tEND OF PROGRAM";
print "\n\n";

Display Names in Reverse Order Using One-Dimensional Array in Ruby

A simple program that I wrote that will ask the user to give five names of the person that will be stored in a one-dimensional array and then the program will display the list of given names of the user in reverse order.

If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

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 in 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.

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

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing

# sample3.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : June 30, 2019  Sunday  3:15 PM
# Address  : Bacolod City, Negros Occidental
# Tools    : Eclipse IDE and Ruby Version 2.6.3
# Location : Bacolod City, Negros Occidental  
# Website  : http://www.jakerpomperada.com
# Emails   : jakerpomperada@gmail.com and jakerpomperada@yahoo.com
puts "\n\n"
print "\tDisplay Names in Reverse Order Using One-Dimensional Array";
puts "\n\n"
name = []
puts "\tGive Five Names : "
5.times do |x|
name[x] = gets.chomp
end
puts("\n");
print "\t===== DISPLAY RESULT ====="
print "\n";


for i in 4.downto 0
  print("\n");
print("\t #{name[i].upcase}")
end
print "\n\n";
print "\tEND OF PROGRAM";

Grocery Product Display Using One-Dimensional Array in Ruby

A simple program that I wrote using a one-dimensional array in Ruby to display the product number and product name.

If you like my work please click the ads on my website to support my work. I will really appreciate your help. 

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 in 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.

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

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com


Program Listing

# sample1.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : June 30, 2019  Sunday  2:24 PM
# Address  : Bacolod City, Negros Occidental
# Tools    : Eclipse IDE and Ruby Version 2.6.3
# Location : Bacolod City, Negros Occidental  
# Website  : http://www.jakerpomperada.com
# Emails   : jakerpomperada@gmai.com and jakerpomperada@yahoo.com
puts "\n\n"
print "\tGrocery Product Display Using One-Dimensional Array";
puts "\n\n"
item_no = [1,2,3,4,5]
products = ['Coke','Lucky Me','Milo','Argentina','Nido']

print("\t");
print item_no[0] 
print("\t")
print products[0]
puts("\n");
print("\t")
print item_no[1] 
print("\t")
print products[1]
puts("\n");
print("\t")
print item_no[2] 
print("\t")
print products[2]
puts("\n");
print("\t")
print item_no[3] 
print("\t")
print products[3]
puts("\n");
print("\t")
print item_no[4] 
print("\t")
print products[4]
print "\n\n";
print "\tEND OF PROGRAM";