Created
April 10, 2014 09:50
-
-
Save notrab/10363010 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DoorCore | |
def initialize(input_width) | |
@min_height = 2120.to_f | |
@max_height = 2455.to_f | |
@min_width = 915.to_f | |
@max_width = 1080.to_f | |
@input_width = input_width | |
end | |
def predicted_max_height | |
@result = @max_height - (@input_width - @min_width) * (@max_height - @min_height) / (@max_width - @min_width) | |
@result.floor | |
end | |
end | |
puts "\n---------------------------\nWhat is your desired width?\n---------------------------\n" | |
desired_width = gets.to_f | |
app = DoorCore.new(desired_width) | |
output = app.predicted_max_height | |
puts "\nResult: #{output}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
and for calculated width