Ruby program to calculate salary hike

Views: 160   

Following program shows you how to calculate salary hike.
In this program we get salary per month and hike from user and calculate new salary with hike using following formula
Salary hike = oldSalaryPerMonth + (oldSalaryPerMonth X hike/100)

 puts "Enter your old salary per month:"
 oldSalaryPerMonth = Integer(gets.chomp)
 puts "Enter your hike percentage:"
 hike = Integer(gets.chomp)
 presentSalaryPerMonth = oldSalaryPerMonth + (oldSalaryPerMonth * hike/100)
 puts "After hike your present salary per month is: #{presentSalaryPerMonth}"


Enter your old salary per month:
Enter your hike percentage:
After hike your present salary per month is: 55000
On By