Friday, June 28, 2019

Simple Payroll Program Using Methods in Ruby

A simple payroll program that I wrote using Ruby programming language using methods.

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



Sample Program Output


Program Listing

# payroll.rb
# Author   : Jake Rodriguez Pomperada,BSCS,MAED-IT
# Date     : June 18, 2019  Tuesday  3:48 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 display_result()
  puts "\n\n"
  print "\tSimple Payroll Program Using Methods";
  puts "\n\n"
  print "\tHow Many Days Work?   ";
  days = gets;
  days = days.to_i;
  print "\tSalary Per Day     : PHP ";
  rate = gets;
  rate = rate.to_f;
  
  # Solving Gross Salary Here 
  solve_gross = (days * rate);
  
  print "\n\n";
  puts "\tThe Gross Salary is PHP  %0.2f." % [solve_gross];
  print "\n\n";
  print "\tSSS Contribution        : PHP ";
  sss = gets;
  sss = sss.to_f;
  print "\tPAG-IBIG Contribution   : PHP  ";
  pag_ibig = gets;
  pag_ibig = pag_ibig.to_f;
  print "\tBIR Contribution        : PHP  ";
  bir = gets;
  bir = bir.to_f;
  print "\tPHILHEALTH Contribution : PHP   ";
  philhealth = gets;
  philhealth = philhealth.to_f;

  # Solving Total Deductions and Net Salary Here 
  total_deductions = (sss+pag_ibig+bir+philhealth);
  solve_net_salary = (solve_gross - total_deductions);

  print "\n\n";
  print "\t===== DISPLAY RESULT ====="
  print "\n\n";
  puts "\tGross Salary     : PHP %0.2f " % [solve_gross];
  print "\n";
  puts "\tTotal Deductions : PHP %0.2f " % [total_deductions];
  print "\n\n";
  puts "\tNet Salary       : PHP %0.2f " % [solve_net_salary];
  print "\n\n";
  print "\tEND OF PROGRAM";
  print "\n\n";
end

# Execution of our method display_result()   

display_result();


   




No comments:

Post a Comment