Friday, May 24, 2019

Find Maximum Value Between Two Numbers in Ruby

A simple program that I wrote using Ruby programming language to find the maximum value between two numbers. I am still a beginner in Ruby programming I hope you will find my work useful.

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

# maximum.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : May 23, 2019   Thursday  2:42 PM
# Address  : Bacolod City, Negros Occidental
# Tools    : Eclipse IDE and Ruby Version 2.6.3
# Location : Bacolod City, Negros Occidental  
# Emails   : jakerpomperada@gmai.com and jakerpomperada@yahoo.com
puts "\n\n"
print "\tFIND MAXIMUM BETWEEN TWO NUMBERS CHECKER";
puts "\n\n"
print "\tGive First Value  : ";
a = gets.chomp
a = a.to_i;
print "\tGive Second Value : ";
b = gets.chomp
b = b.to_i;

print "\n\n";
print "\t===== DISPLAY RESULT ====="
print "\n\n";

if(a > b)
   print("\tThe first number #{a} is maximum.");
else    
   print("\tThe second number #{b} is maximum.");
end  

print "\n\n";
print "\tEND OF PROGRAM";
print "\n\n";




Tuesday, May 21, 2019

Money Bill Checker in Ruby

Here is a copy that I converted from C into Ruby I called this program money bill checker. Write and Design a program that will ask the user to give an amount and then the program will check and determine the money bill denomination based on the amount given by the user. The money bill denomination to be used in the program will be 500,100,50,20,10,5,2 and 1 bills.

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

# bill.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : May 21, 2019   Wednesday
# Address  : Bacolod City, Negros Occidental
# Tools    : Eclipse IDE and Ruby Version 2.6.3
# Location : Bacolod City, Negros Occidental  
# Emails   : jakerpomperada@gmai.com and jakerpomperada@yahoo.com
puts "\n\n"
print "\tMoney Bill Checker";
puts "\n\n"
print "\tEnter amount:   ";
amount = gets;
amount = amount.to_i;
if(amount >= 500)
        note500 = amount/500;
        amount -= note500 * 500;
else
  note500 = 0;
end   
  
if(amount >= 100)
        note100 = amount/100;
        amount -= note100 * 100;
else
  note100 = 0;
 end
    
if(amount >= 50)
     note50 = amount/50;
     amount -= note50 * 50;
else
  note50 = 0;       
end

if(amount >= 20)
     note20 = amount/20;
     amount -= note20 * 20;
else 
  note20 = 0;  
end
   
if(amount >= 10)
       note10 = amount/10;
       amount -= note10 * 10;
else 
   note10 = 0;    
end

if(amount >= 5)
     note5 = amount/5;
     amount -= note5 * 5;
else
   note5 = 0;     
end

if(amount >= 2)
    note2 = amount /2;
    amount -= note2 * 2;
else
  note2 = 0;    
end
   
if(amount >= 1)
     note1 = amount;
else
  note1 = 0;     
end    
   
print("\n\n");
print("\t===== DISPLAY RESULT =====");
print("\n\n");
print("\tTotal number of notes = \n");
print("\n\n");
print("\t500 =  #{note500}\n");
print("\t100 =  #{note100}\n");
print("\t50  =  #{note50}\n");
print("\t20  =  #{note20}\n");
print("\t10  =  #{note10}\n");
print("\t5   =  #{note5}\n");
print("\t2   =  #{note2}\n");
print("\t1   =  #{note1}\n");
print "\n\n";
print "\tEND OF PROGRAM";
print "\n\n";




Addition of Two Numbers in Swift

Here is a sample program to add the two numbers using Swift. I am still a beginner in Swift 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

addition.swift


/* addition.swift
   Created By Mr. Jake Rodriguez Pomperada,MAED-IT
   May 21, 2019
 */

import Swift

print("\n")
print("\tAddition of Two Numbers in Swift")
print("\n")
print("\tGive first value : ");
 var a = Int(readLine()!);
print("\tGive second value : ")
  var b = Int(readLine()!);

var c = a!+b!;
print("\tThe sum is \(c).")
print("\n")
print("\tEnd of Program")
print("\n")


Hello World Using Swift

A very simple program that I wrote using Swift programming language in Windows operating system which I download in this web address https://swiftforwindows.github.io/  I hope you will find my work useful.


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


helloworld.swift

// Hello World Program in Swift
// May 21, 2019 Bacolod City, Negros Occidental Philippines

import Swift

print("\n")
print("\tHello, World From Swift From Jake R. Pomperada")
print("\n")
print("\tEnd of Program")
print("\n")







Wednesday, May 15, 2019

Login System Using Ruby and MySQL

A simple program that I wrote that will allow the user to log in the system using Ruby programming language and MySQL. I am a beginner in Ruby programming and I have found hard to find a code on the Internet about Ruby and MySQL Login System to I wrote one. I hope you will find my work useful.

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

login.rb

###################################################
# Author    : Mr. Jake Rodriguez Pomperada,MAED-IT
# Tools     : Ruby Version 2.6.3 and Notepad++
# Date      : May 15, 2019   Wednesday
# Location  : Bacolod City,Negros Occidental
# Website   : http://www,jakerpomperada.com
# Email     : jakerpomperada@gmail.com
###################################################

# login - database
# users  - table
#
# id - primary key
# username - varchar(100)
# password - varchar(100)


require 'mysql'

class MysqlDatabase
  def initialize(server,database,username,password)
    @svr = server
    @db = database
    @usr = username
    @pwd = password
  end


  def login_check(uname,pword)
    mysql = Mysql.connect(@svr, @usr, @pwd, @db)
  
    stmt = mysql.prepare('SELECT username,password FROM users WHERE username = ?  AND password = ?')
    stmt.execute uname,pword
n_rows = stmt.num_rows
 
if n_rows == 1
print "\n\n"
   print "\tWelcome to the System #{uname.upcase}."
   print "\n\n"
else
  print "\n\n"
  print "\tAccess Denied. Try Again Please."
  print "\n\n"
  mysql.close()
  end
    
  end
end

   print "\n\n"
     print "\tLOGIN SYSTEM USING RUBY AND MYSQL\n\n"
     print "\tAUTHOR: JAKE RODRIGUEZ POMPERADA"
print "\n\n"
print "\tEnter Username      : "
     username2 = gets.chomp
print "\tEnter Password      : "
     password2 = gets.chomp
 
db = MysqlDatabase.new('127.0.0.1','login','root','')
db.login_check(username2.downcase,password2.downcase)

# End of Code


users.sql

-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 15, 2019 at 06:09 AM
-- Server version: 10.1.38-MariaDB
-- PHP Version: 7.1.28

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `login`
--

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int(11) NOT NULL,
  `username` varchar(100) NOT NULL,
  `password` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `username`, `password`) VALUES
(1, '123', '123'),
(2, 'admin', 'admin'),
(3, 'jake', 'jake'),
(4, 'root', 'root'),
(5, 'abc', 'abc'),
(6, 'demo', 'demo');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;



Tuesday, May 14, 2019

Student Information System Using Ruby and MySQL

In this article, I would like to share with you guys a CRUD application that I wrote using Ruby and MySQL. The application can add, edit, delete, view student records.

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

menu.rb

###################################################
# Author    : Mr. Jake Rodriguez Pomperada,MAED-IT
# Tools     : Ruby Version 2.6.3 and Notepad++
# Date      : May 14, 2019   Tuesday
# Location  : Bacolod City,Negros Occidental
# Website   : http://www,jakerpomperada.com
# Email     : jakerpomperada@gmail.com
###################################################

require 'mysql'

class MysqlDatabase
  def initialize(server,database,username,password)
    @svr = server
    @db = database
    @usr = username
    @pwd = password
  end

  def connect
    mysql = Mysql.connect(@svr, @usr, @pwd, @db)
    mysql.close()
  end

  def create_data(fname,lname,course,email)
    mysql = Mysql.connect(@svr, @usr, @pwd, @db)
stmt = mysql.prepare('INSERT INTO students(firstname,lastname,course,email) VALUES (?,?,?,?)')
    stmt.execute fname,lname,course,email
print "\n\n"
print "\tRecord has been saved in the database."
print "\n\n"
    mysql.close()
  end

  def read_data
    mysql = Mysql.connect(@svr, @usr, @pwd, @db)
    print("\n\n")
print("\t----------------------------------------")   
print("\n")
    print("\t\tVIEW ALL STUDENTS RECORDS")
print("\n")
    print("\t----------------------------------------")
print("\n\n")
print("\tID \tLASTNAME \tFIRSTNAME \tCOURSE \t\tEMAIL")
    print("\n\n")
    results = mysql.query('SELECT id,lastname,firstname,course,email FROM students ORDER BY lastname ASC')
    results.each do | id,lastname,firstname,course,email|
      print("\t#{id}\t#{lastname}\t#{firstname} \t#{course}\t#{email}\n")
    end
    mysql.close()
  end

  def update_data(id,fname,lname,course,email)
    mysql = Mysql.connect(@svr, @usr, @pwd, @db)
print("\n")
    print("\tUpdationg Student Record ID No. #{id}")
    stmt = mysql.prepare('UPDATE students SET firstname=?,lastname=?,course=?,email=? WHERE id=?')
    stmt.execute fname,lname,course,email,id
    print "\n\n"
print "\tRecord has been updated in the database."
print "\n\n"
    mysql.close()
  end

  def delete_data(id)
    mysql = Mysql.connect(@svr, @usr, @pwd, @db)
print("\n")
    print("\tDeleting Student Record ID No.#{id}")
    stmt = mysql.prepare('DELETE FROM students  WHERE id=?')
    stmt.execute id
    print "\n\n"
print "\tRecord has been deleted in the database."
print "\n\n"
    mysql.close()
  end
    
  
end

def menu

loop do

print "\n\n"
print "\t===== STUDENT INFORMATION SYSTEM IN RUBY AND MYSQL =====\n"
print "\t\t  AUTHOR: JAKE RODRIGUEZ POMPERADA"
print "\n\n"
print "\t[1] ADD    STUDENT RECORD\n"
print "\t[2] UPDATE STUDENT RECORD\n"
print "\t[3] VIEW   STUDENT RECORD\n"
print "\t[4] DELETE STUDENT RECORD\n"
print "\t[5] QUIT PROGRAM"
print "\n\n"
print "\tSELECT YOUR CHOICE :=> "
input = gets.strip

    case input
    when "1"
     print "\n\n"
         print "\tADD STUDENT RECORD"
print "\n\n"
print "\tGive Student First Name     : "
         fname = gets.chomp
print "\tGive Student Last Name      : "
         lname = gets.chomp
print "\tGive Student Course         : "
         course = gets.chomp
print "\tGive Student Email Address  : "
         email = gets.chomp
db = MysqlDatabase.new('127.0.0.1','school','root','')
db.create_data(fname.upcase,lname.upcase,course.upcase,email.downcase)
    when "2"
         print "\n\n"
         print "\tUPDATE STUDENT RECORD"
print "\n\n"
print "\tGive Student ID Number     : "
         id = gets;
id = id.to_i;
print "\tGive Student First Name     : "
         fname = gets.chomp
print "\tGive Student Last Name      : "
         lname = gets.chomp
print "\tGive Student Course         : "
         course = gets.chomp
print "\tGive Student Email Address  : "
         email = gets.chomp
db = MysqlDatabase.new('127.0.0.1','school','root','')
db.update_data(id,fname.upcase,lname.upcase,course.upcase,email.downcase)
    when "3"
    db = MysqlDatabase.new('127.0.0.1','school','root','')
        db.read_data()
    when "4"
         print "\n\n"
         print "\tDELETE STUDENT RECORD"
print "\n\n"
print "\tGive Student ID Number     : "
         id = gets;
id = id.to_i;
db = MysqlDatabase.new('127.0.0.1','school','root','')
         db.delete_data(id)
 
    when "5"
     print("\n\n")
print("\tTHANK YOU FOR USING THIS PROGRAM")
     print("\n\n")
         return
      else
    print("\n")
        print("\tInvalid option: #{input}. Try Again.")
print("\n")
    end
 end
end

menu

# End of Code

students.sql

-- phpMyAdmin SQL Dump
-- version 4.8.5
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: May 14, 2019 at 09:53 AM
-- Server version: 10.1.38-MariaDB
-- PHP Version: 7.1.28

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `school`
--

-- --------------------------------------------------------

--
-- Table structure for table `students`
--

CREATE TABLE `students` (
  `id` int(11) NOT NULL,
  `firstname` varchar(200) NOT NULL,
  `lastname` varchar(200) NOT NULL,
  `course` varchar(200) NOT NULL,
  `email` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Dumping data for table `students`
--

INSERT INTO `students` (`id`, `firstname`, `lastname`, `course`, `email`) VALUES
(1, 'JAKE', 'POMPERADA', 'BS INFORMATION TECHNOLOGY', 'jakerpomperada@aol.com'),
(2, 'ALLIE ', 'POMPERADA', 'BS CHEMCIAL ENGINEERING', 'allie_pomperada@yahoo.com.ph'),
(4, 'JACOB SAMUEL', 'POMPERADA', 'BS COMPUTER ENGINEERING', 'jacobsamuel_pomperada@hotmail.com'),
(5, 'JULIANNA RAE', 'POMPERADA', 'BS BUSINESS MANAGEMENT', 'iya_pomperada@gmail.com');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `students`
--
ALTER TABLE `students`
  ADD PRIMARY KEY (`id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `students`
--
ALTER TABLE `students`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;