Top Level Namespace
Defined Under Namespace
Classes: Average, Circle, Cube, GeometricMean, GeometricMeanModule, Test, Triangle
Instance Method Summary collapse
Instance Method Details
#tasks ⇒ Object
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/gh_task_hw5.rb', line 1 def tasks # require './classes' require 'gh_gem_hw5_test_suite' require 'colorize' # ----------------------------------------------------------------- task = '1.3' puts "----| Execution 1 | of task #{task} -----".white.on_black unit = 'meter' units = 'meters' edge_cube_length = 2 volume = Cube.volume(edge_cube_length) square = Cube.cube_plane_square(edge_cube_length) condition = 'We have length edge of cube equal = '\ "#{edge_cube_length} #{units}."\ ' Find volume and square of cube.'.yellow puts condition puts "Volume of cube = #{volume} cubic #{unit}." puts "Cube plane square = #{square} square #{units}." puts # ----------------------------------------------------------------- task = '1.4' puts "----| Execution 2 | of task #{task} -----".white.on_black number1 = 30 number2 = 19 numbers = [number1, number2] average = Average.count(numbers) geometric = GeometricMean.count(numbers) puts "We have two numbers #{number1} and #{number2}."\ 'Find average and geometric mean'.yellow puts "Average #{number1} and #{number2} is #{average}" puts "Geometric mean #{number1} and #{number2} is #{geometric}" puts # ----------------------------------------------------------------- task = '1.5' puts "----| Execution 3 | of task #{task} -----".white.on_black number1 = -30 number2 = 19 numbers = [number1, number2] average = Average.count(numbers) geometric = GeometricMeanModule.count(numbers) puts "We have two numbers #{number1} and #{number2}.".yellow puts 'Find average and geometric mean'.yellow puts "Average #{number1} and #{number2} is #{average}" puts "Geometric mean #{number1} and #{number2} by module is #{geometric}" puts # ----------------------------------------------------------------- task = '1.6' puts "----| Execution 4 | of task #{task} -----".white.on_black cathetus1 = 3 cathetus2 = 6.5 angle = { a: 90 } angle_side = { b: cathetus1, c: cathetus2 } triangle = Triangle.new(angle, angle_side) square = triangle.square hypotenuse = triangle.hypotenuse puts "Cathetus 1 = #{cathetus1} sm and cathetus 2 = #{cathetus2} sm.".yellow puts 'Finf triangle sqare and hypotenuse'.yellow puts "Hypotenuse is #{hypotenuse} sm." puts "Triangle square is #{square} square sm." puts task = '1.12' puts "----| Execution 5 | of task #{task} -----".white.on_black side = 5 sides_length = { a: side, b: side, c: side } angle = { a: 60 } triangle = Triangle.new(angle, sides_length) square = triangle.square puts "Triangle side = #{side} sm".yellow puts 'Find triangle square'.yellow puts "Triangle square is #{square} square sm." puts task = '1.15' puts "----| Execution 6 | of task #{task} -----".white.on_black hypotenuse = 20 cathetus = 10 angle = { a: 90 } side = { a: hypotenuse, b: cathetus } find = Triangle.new(angle, side) second_cathetus = find.cathetus side[:c] = second_cathetus find = Triangle.new(angle, side) radius = find.radius_circle_inside_triangle puts "Hypotenuse = #{hypotenuse} sm, cathetus = #{cathetus} sm.".yellow puts '1. Find second cathetus'.yellow puts '2. Find radius of circle drower inside this triangle'.yellow puts "1. Second cathetus = #{second_cathetus} sm." puts "2. Radius = #{radius}sm." puts task = '1.16' puts "----| Execution 7 | of task #{task} -----".white.on_black circle_length = 50 circle = Circle.new(circle_length) circle_square = circle.square puts "Circle length = #{circle_length} sm.".yellow puts 'Find square this circle.'.yellow puts "Circle square = #{circle_square} square sm." puts test_1_3 test_1_4 test_1_5 test_1_6 test_1_12 test_1_15 test_1_16 end |