Skip to content

Instantly share code, notes, and snippets.

@IotaSpencer
Created January 25, 2016 01:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IotaSpencer/7ad4dd7daed26ed3657c to your computer and use it in GitHub Desktop.
Save IotaSpencer/7ad4dd7daed26ed3657c to your computer and use it in GitHub Desktop.
Fixed Perdiem
ken@ken:~/Documents$ ruby perdiem.rb
Insert dates. (dd/mm/yyyy)
starting date...
01/01/1970
ending date...
01/01/1971
365
#! /usr/bin/env/ruby
require 'date'
class PerDiem
PERDIEM = 93.00
def get_dates
puts "Insert dates. (dd/mm/yyyy)"
puts "starting date..."
@start_date = Date.parse(gets.chomp)
puts "ending date..."
@end_date = Date.parse(gets.chomp)
end
def number_of_days
number_of_days = (@end_date - @start_date).to_i
end
def calculate_per_diem
PERDIEM * number_of_days
end
end
darin = PerDiem.new
darin.get_dates
puts darin.number_of_days
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment