Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##Justin Beitz
- ##Assignment 3
- def create_array (data)
- data.chomp.split(' ').map(&:to_i) # returns array of ints
- end
- def calc_average (data)
- average = data.reduce(:+) / data.size.to_f
- end
- unless ARGV[0].to_s == "input.txt"
- puts "Wrong input"
- end
- unless ARGV[1].to_s == "output.txt"
- puts "Wrong output"
- end
- input = ARGV[0].to_s
- output = ARGV[1].to_s
- def fileIO
- in_file = File.new(ARGV[0], 'r')
- store = in_file.each_line do |line|
- array_of_ints = create_array(line)
- avgerage = calc_average(line)
- median = calc_median(line)
- end
- end
- fileIO
Advertisement
Add Comment
Please, Sign In to add comment