Title / Description
Code class TopovskiNapad SVETLOBNA_HITROST = 299792458 attr_accessor :razdalja_do_tarce attr_accessor :hitrost attr_accessor :kot def initialize @razdalja_do_tarce = Random.rand(10...1000) end def izracun_razdalje_strela @razdalja_do_tarce = ((@hitrost ** 2) * (Math.sin(2 * @kot * Math::PI / 180) )/10) end def vnesi_hitrost hitrost = preberi_vnos if(hitrost.to_i > 0 && hitrost.to_i < SVETLOBNA_HITROST) @hitrost = hitrost.to_i else puts "vnesli ste neveljavno hitrost!" end end def vnesi_kot kot = preberi_vnos if(kot.to_i > 0 && kot.to_i < 90) @kot = kot.to_i else puts "vnesli ste neveljaven kot!" end end def preberi_vnos gets.chomp end end
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code