Module: Roebe::Math::Zylinder

Defined in:
lib/roebe/math/zylinder.rb

Class Method Summary collapse

Class Method Details

.calculate_the_volume(radius = 5, height = 10, round_to_n_positions = 3) ⇒ Object

#

Roebe::Math::Zylinder.calculate_the_volume

#


41
42
43
44
45
46
47
48
49
# File 'lib/roebe/math/zylinder.rb', line 41

def self.calculate_the_volume(
    radius               =  5,
    height               = 10,
    round_to_n_positions =  3
  )
  radius = radius.to_f
  height = height.to_f
  return (::Math::PI * (radius ** 2) * height).round(round_to_n_positions)
end

.formula_volumeObject

#

Roebe::Math::Zylinder.formula_volume

#


18
19
20
# File 'lib/roebe/math/zylinder.rb', line 18

def self.formula_volume
  'V = G * h' # Grundfläche * Höhe
end

.show_formulasObject

#

Roebe::Math::Zylinder.show_formulas

PI is Math::PI.

#


27
28
29
30
31
32
33
34
35
36
# File 'lib/roebe/math/zylinder.rb', line 27

def self.show_formulas # formula tag
  e
  e 'u = 2 *  PI * r     (Umfang)'
  e 'G = PI * r²         (Grundfläche)'
  e 'M = u·h = 2·PI·r·h  (Mantelfläche)'
  e 'O = M + 2G          (Oberfläche)'
  e 'V = PI * r² * h     (Volumen)'
  e 'PI ist die Kreiszahl 3,1415926535'
  e
end