Thursday, October 20, 2016

Factorial in Ruby

In this simple program I called this program factorial in ruby what does the program will do is to ask the user to give a number and then our program will compute the factorial value of the given number by the user using Ruby as our programming language. I hope you like this program. Thank you.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 


My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 


My mobile number here in the Philippines is 09173084360.


Program Listing

factorial.rb


def fact(n)
 puts 1.upto(n).inject('*')
end

loop do
print "\n\n";
print "Factorial Program"
print "\n\n";
print "Give a Number : ";
val1 = gets.chomp
val1 = val1.to_i;
print "\n\n";
print "The factorial value of #{val1} is "
print fact(val1);
print "\n\n";
print "Do you want to continue? (y/n) : "
answer = gets.chomp.downcase
  if answer == "n"
print "\n\n";
print "End of Program";
print "\n\n";
break
  end
end




Palindrome in Ruby

Here is a simple program that I wrote in Ruby programming language that will ask the user to give a string or a word and then our program will check if the given word or a string is a palindrome or not a palindrome. We can called a word a palindrome if we read the word forward and backward the spelling and the sound is the same. I hope you will find my work useful. Thank you.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 


My mobile number here in the Philippines is 09173084360.


Program Listing

palindrome.rb

def check_palindrome(str)
  if str.reverse == str
    puts "\n\n";
    puts "The given word #{str} is a palindrome."
puts "\n";
  else
puts "\n";
    puts "The given word #{str} isn't a palindrome."
puts "\n";
  end
end

loop do
print "\n\n";
print "Palindrome Program"
print "\n\n";
print "Enter a String : ";
str_test = gets.chomp
check_palindrome(str_test.upcase)
puts "\n";
print "Do you want to continue? (y/n) : "
  answer = gets.chomp.downcase
  if answer == "n"
print "\n\n";
    print "End of Program";
    print "\n\n";
break
  end
end

Sunday, October 16, 2016

Payroll System in C#

Here is a simple payroll system that I wrote using Microsoft C# programming language this payroll system is based here in the Philippine setting for the deductions like tax, philhealth, sss, pag-ibig. Our program will ask the name of the employee, position of the employee, rate per day and number of days the employee work in the company and then our program will compute the gross pay, total deductions and finally the net pay of the salary of the employee. I hope you will like my work thank you.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 


My mobile number here in the Philippines is 09173084360.




Sample Program Output


Program Listing

payroll.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

// October 16, 2016  Sunday
// Author : Mr. Jake R. Pomperada, MAED-IT
// Program to compute the salary of an employee in a company.

namespace payroll_solver
{
    class payroll
    {
        static void Main(string[] args)
        {
            string emp_name,position,reply;
            int no_days_work = 0,n=0;
            double sss = 0, philhealth = 0, tax=0,pag_ibig=0, daily_rate=0;
            double total_deductions = 0, gross_pay = 0, net_pay = 0;

            
        do {
            Console.Clear();
            Console.Write("EMPLOYEE'S PAYROLL SYSTEM");
            Console.Write("\n\n");
            Console.Write("Enter Employee's Name       : ");
            emp_name = Console.ReadLine();
            Console.Write("Enter Employee's Position   : ");
            position = Console.ReadLine();
            Console.Write("Enter Number of Day's Work  : ");
            no_days_work = Convert.ToInt32(Console.ReadLine());
            Console.Write("Enter Daily Salary Rate     : ");
            daily_rate = Convert.ToDouble(Console.ReadLine());

            gross_pay = (no_days_work * daily_rate);

            Console.Write("\n\n");
            Console.WriteLine("Gross Pay       : Php {0:0.00}.",  gross_pay);
            Console.Write("\n\n");
            Console.Write("===== DEDUCTIONS =====");
            Console.Write("\n\n");
            Console.Write("Enter SSS Contribution            : ");
            sss = Convert.ToDouble(Console.ReadLine());
            Console.Write("Enter PAG-IBIG Contribution       : ");
            pag_ibig = Convert.ToDouble(Console.ReadLine());
            Console.Write("Enter PHILHEALTH Contribution     : ");
            philhealth = Convert.ToDouble(Console.ReadLine());
            Console.Write("Enter BIR TAX Contribution        : ");
            tax = Convert.ToDouble(Console.ReadLine());

            total_deductions = (sss + pag_ibig + philhealth + tax);

            net_pay = (gross_pay - total_deductions);

            Console.Write("\n\n");
            Console.WriteLine("Total Deductions      : Php {0:0.00}.", total_deductions);
            Console.Write("\n\n");
            Console.Write("===== DISPLAY RESULTS =====");
            Console.Write("\n\n");
            Console.WriteLine("Employee's Name       : {0}.", emp_name);
            Console.WriteLine("Empoyee's  Position   : {0}.", position);
            Console.WriteLine("Gross Pay             : Php {0:0.00}.", gross_pay);
            Console.WriteLine("Total Deductions      : Php {0:0.00}.", total_deductions);
            Console.Write("\n\n");
            Console.WriteLine("Net Pay               : Php {0:0.00}.", net_pay);
            Console.Write("\n\n");
            Console.Write("Do You Want To Continue? Y/N : ");
            reply = Console.ReadLine();

            if (reply == "y" || reply == "Y")
            {
                continue;
            }
            else if (reply == "n" || reply == "N")
            {
                Console.Write("\n\n");
                Console.Write("Thank You For Using This Software.");
                Console.Write("\n\n");
                break;
            }
           
        } while (n == 0);
          Console.ReadLine();
        } 
    }
}



Product Bill Calculator in C#

Here is a sample program that I wrote in C# that will ask the user to give the product name, product quantity and product price and then our program will compute for the total cost of the product. What is good about this program is that I added a function that will prompt and ask the user do you want to continue using this program or not which enables the user to repeat the program running again and able to provide new values in a the other product. I hope you will find my work useful. Thank you.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.




Sample Program Output

Program Listing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

// October 16, 2016  Sunday
// Author : Mr. Jake R. Pomperada, MAED-IT
// Program to compute bill given price and quantity

namespace bill_solver
{
    class bill
    {
        static void Main(string[] args)
        {
            string product_name, reply;
            int quantity = 0,n=0;
            double price = 0, amount = 0;
            
        do {
            Console.Clear();
            Console.Write("Product Bill Calculator");
            Console.Write("\n\n");
            Console.Write("Enter Product Name      : ");
            product_name = Console.ReadLine();
            Console.Write("Enter Quantity          : ");
            quantity = Convert.ToInt32(Console.ReadLine());
            Console.Write("Enter Product Price Php : ");
            price = Convert.ToDouble(Console.ReadLine());

            amount = (quantity * price);

            Console.Write("\n\n");
            Console.Write("===== DISPLAY RESULTS =====");
            Console.Write("\n\n");
            Console.WriteLine("Product          :  {0}.", product_name);
            Console.WriteLine("Price            :  {0:0.00}.", price);
            Console.WriteLine("Quantity         :  {0}.", quantity);
            Console.Write("\n\n");
            Console.WriteLine("Total Cost       : Php {0:0.00}.", amount);
            Console.Write("\n\n");
            Console.Write("Do You Want To Continue? Y/N : ");
            reply = Console.ReadLine();

            if (reply == "y" || reply == "Y")
            {
                continue;
            }
            else if (reply == "n" || reply == "N")
            {
                Console.Write("\n\n");
                Console.Write("Thank You For Using This Software.");
                Console.Write("\n\n");
                break;
            }
           
        } while (n == 0);
        Console.ReadLine();
        } 
    }
}



Saturday, October 15, 2016

Basic User Input in C#

This simple program will show you basic input and output operations in Microsoft C# programming language.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.




Sample Program Output

Program Listing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace basic_user_input
{
    class user_input
    {
        static void Main(string[] args)
        {
            string name;
            int age=0;
            double height=0;

            Console.Write("Basic User Input in C# ");
            Console.Write("\n\n");
            Console.Write("What is your name : ");
            name = Console.ReadLine();
            Console.Write("What is your age  : ");
            age = Convert.ToInt32(Console.ReadLine());
            Console.Write("What is your height in Centimeter(s) : ");
            height = Convert.ToDouble(Console.ReadLine());

            //Print a blank line
            Console.WriteLine();

            //Show the details you typed
            Console.Write("\n\n");
            Console.Write("===== DISPLAY REPORT =====");
            Console.Write("\n\n");
            Console.WriteLine("Name is {0}.", name);
            Console.WriteLine("Age is {0}.", age);
            Console.WriteLine("Height is {0}.", height);
            Console.Write("\n\n");
            Console.Write("End of Program");
            Console.ReadLine();
        }
    }
}




Seconds To Hours, Minutes and Seconds in C#

A very simple program that I wrote using C# as my programming language that will ask the user to give time in seconds and then our program will converted the given time in hours, minutes and seconds.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.




Sample Program Output

Program Listing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace time_conversion
{
    class time_check
    {
        static void Main(string[] args)
        {
            long v,sec,hr,min; 

            Console.Write("Time Converter Converter");
            Console.Write("\n\n");
            Console.Write("Enter Time in Seconds   : ");
            sec = Convert.ToInt32(Console.ReadLine());

            hr=sec/3600; 
            v=sec%3600; 
            min=v/60; 
            sec=v%60; 

            Console.Write("\n\n");
            Console.Write("===== DISPLAY REPORT =====");
            Console.Write("\n\n");
            Console.WriteLine(" Time in hour:min:sec is: {0}:{1}:{2}." ,hr,min,sec);
            Console.Write("\n\n");
            Console.Write("End of Program");
            Console.ReadLine();
        }
    }
}








Loan Interest Solver in C# Using Console

Here is a simple program that I wrote using Microsoft C# programming language that will compute for the interest to be paid by the customer to the loan that he or she acquire from a bank or a lending institution. What does our program will do is to ask the user to give the principal amount being borrowed, second our program will ask the rate of interest and finally the third our program will ask time refers to the number of years the loan amount should be paid of by the borrower. The code is very simple and easy to understand.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.




Sample Program Output

Program Listing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace loan_solve_problem
{
    class loan_solver
    {
        static void Main(string[] args)
        {
            double amount=0, rate=0, time=0, solve_interest=0;

            Console.Write("Loan Interest Solver");
            Console.Write("\n\n");
            Console.Write("Enter Principal Amount    : ");
            amount = Convert.ToDouble(Console.ReadLine());
            Console.Write("Enter Rate of Interest    : ");
            rate = Convert.ToDouble(Console.ReadLine());
            Console.Write("Enter Period of Interest  : ");
            time  = Convert.ToDouble(Console.ReadLine());
              
            solve_interest = (amount * rate * time) / 100;

            Console.Write("\n\n");
            Console.Write("===== DISPLAY REPORT =====");
            Console.Write("\n\n");
            Console.WriteLine("The Interest is Php {0:0.00}.", solve_interest);
            Console.Write("\n\n");
            Console.Write("End of Program");
            Console.ReadLine();
        }
    }
}





Student Grade Solver in C# Using Console


Here is a sample program that I wrote using C# as my programming language that will ask the user to give the student name, subject, prelim, midterm and endterm grade and then our program will compute for the final grade of the student using C# in console environment.

Add me at Facebook my address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com. 

My mobile number here in the Philippines is 09173084360.




Sample Program Output

Program Listing

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace student_grade_solver
{
    class grade_solve
    {
        static void Main(string[] args)
        {
            string student_name, subject;
            double prelim = 0, midterm = 0, endterm = 0;
            double final_grade = 0;
           
            Console.Write("Student Grade Solver");
            Console.Write("\n\n");
            Console.Write("Student Name    : ");
            student_name = Console.ReadLine();
            Console.Write("Subject         : ");
            subject = Console.ReadLine();
            Console.Write("Prelim Grade    : ");
            prelim = Convert.ToDouble(Console.ReadLine());
            Console.Write("Midterm Grade   : ");
            midterm = Convert.ToDouble(Console.ReadLine());
            Console.Write("Endterm Grade   : ");
            endterm = Convert.ToDouble(Console.ReadLine());

            final_grade = (prelim * 0.2) + (midterm * 0.3) + (endterm * 0.5); 

            Console.Write("\n\n");
            Console.Write("===== DISPLAY REPORT ====="); 
            Console.Write("\n\n");
            Console.WriteLine(" Student Name  :  {0}. ",student_name);
            Console.WriteLine(" Subject       :  {0}. ",subject);
            Console.WriteLine(" Final Grade   :  {0:0}.",final_grade);
            Console.Write("\n\n");
            Console.Write("End of Program");
            Console.ReadLine();
        }
    }
}