Class: Discriminant
- Inherits:
-
Object
- Object
- Discriminant
- Defined in:
- lib/oops_can.rb
Class Method Summary collapse
Class Method Details
.ask ⇒ Object
4 5 6 |
# File 'lib/oops_can.rb', line 4 def self.ask puts "For Learn More About Discriminant Follow ENG http://en.wikipedia.org/wiki/Discriminant" end |
.make ⇒ Object
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 |
# File 'lib/oops_can.rb', line 8 def self.make puts "Please input the A: " a = gets.to_i puts "Please input the B: " b = gets.to_i puts "Please input the C: " c = gets.to_i d = (b**2) - (4 * a * c ) puts "Discriminant: #{d}" if d > 0 x1 = (b - (d ** 0.5))/(2 * a) x2 = (b + (d ** 0.5))/(2 * a) puts "x1: #{x1}" puts "x2: #{x2}" elsif d == 0 x = (-b )/(2 * a) puts "x: #{x}" else puts "Not Found X's" end end |