Wednesday, July 10, 2019

Swap Two Numbers in Ruby


Design and create a program that will ask the user to give two integer numbers and then the program will swap the arrangement of two numbers using methods and display the result 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 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


Sample Program Output

Program Listing

swap.rb


# swap.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : June 17, 2019    Monday  1:18 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

def swap(a,b)
    temp = a
    a = b
    b = temp
    print "\tA = #{a} and B = #{b} ";
    return a,b;
end

puts "\n\n"
print "\tSwap Two Numbers";
puts "\n\n"
print "\tGive First Value  : ";
a = gets;
print "\tGive Second Value : ";
b = gets;

a = a.to_i;
b = b.to_i;
print "\n\n";
print "\tBefore Swapping";
print "\n\n";
print "\tA = #{a} and B = #{b} ";
print "\n\n";
print "\t===== DISPLAY RESULT ====="
print "\n\n";
print "\tAfter Swapping";
print "\n\n";
swap(a,b)
print "\n\n";
print "\tEND OF PROGRAM";
print "\n\n";



Basic Math Operations in Ruby

Create and Design 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 given numbers using methods and 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 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



Sample Program Listing


Program Listing

math.rb


# math.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : May 15, 2019    Wednesday  2;16 PM
# Address  : Bacolod City, Negros Occidental
# Tools    : Eclipse IDE for JavaScript and Web Developers 
#            and Ruby Version 2.6.3
# Location : Bacolod City, Negros Occidental  
# Website  : http://www.jakerpomperada.com
# Emails   : jakerpomperada@gmai.com and jakerpomperada@yahoo.com

def add(a,b)
  return(a+b);
end

def subtract(a,b)
  return(a-b);
end

def multiply(a,b)
  return(a*b);
end

def divide(a,b)
  return(a/b);
end

puts "\n\n"
print "\tBasic Math Operations";
puts "\n\n"
print "\tGive First Value  : ";
val1 = gets;
print "\tGive Second Value : ";
val2 = gets;

val1 = val1.to_i;
val2 = val2.to_i;

sum = add(val1,val2);
difference = subtract(val1,val2);
product = multiply(val1,val2);
quotient = divide(val1,val2);

print "\n\n";
print "\t===== DISPLAY RESULT ====="
print "\n\n";
print "\tThe sum of ",val1," and ",val2," is ",sum,".\n";
print "\tThe difference between #{val1} and #{val2} is #{difference}.\n";
print "\tThe product of #{val1} and #{val2} is #{product}.\n";
print "\tThe quotient between #{val1} and #{val2} is #{quotient}.";
puts "\n\n"
print "\tEnd of Program";
puts "\n"


Power of a Number in Ruby


Design and create a program that will ask the user to give base and exponent values using methods and then the program will compute the power value of the number and then display the result on the screen using Ruby 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 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



Sample Program Output


Program Listing

power.rb


# power.rb
# Written By Mr. Jake Rodriguez Pomperada,BSCS,MAED-IT
# Tools : Ruby 2.6.3 and Sublime Text Editor 
# June 17, 2019    Monday   12:12 PM
# Bacolod City, Negros Occidental
# Website       : http://www.jakerpomperada.com
# Email Address : jakerpomperada@gmail.com and jakerpomperada@yahoo.com

def square_solver(base,exponent)
  return(base ** exponent);
end

puts "\n\n"
print "\tPower of a Number";
puts "\n\n"
print "\tEnter a Base Number : ";
base = gets;
print "\tEnter an Exponent   : ";
exponent = gets;

base = base.to_i;
exponent = exponent.to_i;

solve_power = square_solver(base,exponent);

print "\n\n";
print "\tDISPLAY RESULTS";
print "\n\n";
print "\t#{base} ^ #{exponent} = #{solve_power}";
puts "\n\n";
print "\tEnd of Program";
puts "\n";



Addition of Three Numbers Using Methods in Ruby

Write a program that will ask the user to give three numbers and then the program will compute the total sum of the three numbers using methods and 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 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



Sample Program Output


Program Listing

addition.rb


# addition.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : June 17, 2019   Monday 8:19 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

def add_all(num1, num2, num3)
  return num1 + num2 + num3
end


puts "\n\n"
print "\tAddition of Three Numbers Using Methods";
puts "\n\n"
print "\tGive First Value  : ";
val1 = gets;
print "\tGive Second Value : ";
val2 = gets;
print "\tGive Third Value  : ";
val3 = gets;

val1 = val1.to_i;
val2 = val2.to_i;
val3 =  val3.to_i;
sum = sum.to_i;

sum = add_all(val1,val2,val3);

print "\n";
print "\tThe sum of ",val1,",",val2," and ",val3," is ",sum,".";
puts "\n\n"
print "\tEnd of Program";
puts "\n"






Square and Cube of a Number Solver Using Methods in Ruby


Write a program to ask the user to give an integer number and then the program will compute the square and cube numerical values of the given number and display the result on the result.

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



Sample Program Output


Program Listing

 square_cure.rb


# square_cure.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : June 17, 2019   Monday 11:00 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

def square(a)
  return a * a;
end

def cube(b)
  return b * b * b;
end

puts "\n\n"
print "\tSquare and Cube of a Number Solver Using Methods";
puts "\n\n"
print "\tGive First Value  : ";
val1 = gets;

val1 = val1.to_i;
square_value = square_value.to_i;
cube_value =  cube_value.to_i;


square_value = square(val1);
cube_value = cube(val1);

print "\n\n";
print("\tThe square value of #{val1} is #{square_value}.\n\n")
print("\tThe cube value of #{val1} is #{cube_value}.\n")
puts "\n\n"
print "\tEnd of Program";
puts "\n"



Global Scope Resolution Operator in C++

In this article, I would like to share with you a sample program that I have learned in C++ programming about Global Scope Resolution Operator. This is very important if you are working on a C++ program especially you are dealing with advanced topics in C++ and object-oriented programming.

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



Sample Program Output


Program Listing

scope.cpp


// Global Scope Resolution Operator in C++
// Jake R. Pomperada,MAED-IT
// July 8, 2019   8:20 PM
// Bacolod City, Negros Occidental Philippines

#include <iostream>

using namespace std;

int amt = 456;  // global variable declaration

int main()
{
int amt = 123;  // local variable declaration
cout <<"\n";
cout <<"\tGlobal Scope Resolution Operator in C++";
cout <<"\n\n";
cout << "\tDisplay Global Variable Value :" <<::amt;   // display global variable
cout <<"\n\n";
cout << "\tDisplay Local Variable Value :" << amt;   // display local variable
cout <<"\n\n";
cout <<"\tEnd of Program";
}





Tuesday, July 9, 2019

Leap Year Lister Using Two Dimensional Arrays in Ruby

Write a program using a two-dimensional array that will ask how many numbers of years to be processed and then the program will ask the user to give a series of years.  The program will check and determine which of the given year is a leap year or not a leap year and 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 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


Sample Program Output

Program Listing

# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : July 2, 2019   Tuesday  10:54 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

require 'date'

puts "\n\n"
print "\tLeap Year Lister Using Two Dimensional Arrays";
puts "\n\n"
print "\tEnter number of elements :  ";
num_val = gets.chomp
num_val = num_val.to_i;

year = Array.new() { Array.new(0)}

print("\n")   
for number in (1..num_val)
  print "\tValue in Item No. #{number} : ";
  year[number] = gets.chomp
  year[number] = year[number].to_i;
 end
 print "\n";
 print "\t===== DISPLAY RESULT ====="
 print "\n\n";
for list_down in 1..num_val
    x = Date.leap?(year[list_down])
    if (x== true)
      print ("\tThe given year #{year[list_down]} is LEAP year.\n")
    else
      print ("\tThe given year #{year[list_down]} is NOT LEAP year.\n")
 end
end
print "\n";
print "\tEND OF PROGRAM";
print "\n\n";





Cube Numbers Using Two-Dimensional Arrays in Ruby

Write a program using a two-dimensional array to ask the user to give five numbers and then the program will compute the cube value of each given numbers and 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 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



Sample Program Output


Program Listing

# cube_array.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : June 29, 2019  Saturday  4:27 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 Two-Dimensional Arrays";
puts "\n\n"
val_items = Array.new(5) { Array.new(0)}
sum = 0;
sum = sum.to_i;

5.times do |x|
  print "\tGive value in item no. #{x+1} : "
  val_items[x] = gets.chomp
  val_items[x]  = val_items[x].to_i;
end

puts("\n");
print("\tNumber \t Cube Number Equivalent");
print "\n\n";
for i in val_items
  print("\t");
  print(" #{i} \t\t  #{i**3}\n")
end
    
print "\n";
print "\tEND OF PROGRAM";