rsrrubyquestions 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/rsrrubyquestions.rb +68 -0
  3. metadata +43 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 3590aa6d0c5856d7ab57e598f5b092983b3dabb1
4
+ data.tar.gz: 2ef361794e946722ecea75b117817bc824912154
5
+ SHA512:
6
+ metadata.gz: a7ab88e7f5fbeb66ab4afd285d6f9c4bef5ce5d33e29f3eae6c5f93ffcc11492e73455b97f83ae16998489823748df356034c11d3a20f2adc5b909fa14048319
7
+ data.tar.gz: bd98449a7dd52642231a052e7b27d6509619987a0573d22794867c969aa774232eb83b3797267dd8aa39ca689f012cd6d7e60db6234e6d9e26078032605f1ee8
@@ -0,0 +1,68 @@
1
+ class Questions
2
+ @question = ""
3
+ @answer = 0
4
+
5
+ def self.generate(level)
6
+
7
+ a = rand(100).to_i
8
+ b = rand(100).to_i
9
+ c = rand(100).to_i
10
+ d = rand(100).to_i
11
+ e = rand(100).to_i
12
+
13
+ if level == 1
14
+ @question = "#{a} + #{b}"
15
+ @answer = a + b
16
+ elsif level == 2
17
+ @question = "#{a} + #{b} + #{c}"
18
+ @answer = a + b + c
19
+ elsif level == 3
20
+ @question = "#{a} - #{b}"
21
+ @answer = a - b
22
+ elsif level == 4
23
+ @question = "#{a} + #{b} - #{c}"
24
+ @answer = a + b - c
25
+
26
+ elsif level == 5
27
+ @question = "#{a} x #{b}"
28
+ @answer = a * b
29
+ elsif level == 6
30
+ @question = "#{a} x #{b} x #{c}"
31
+ @answer = a * b * c
32
+
33
+ elsif level == 7
34
+ @question = "#{a} + #{b} / #{c}"
35
+ @answer = a + b / c
36
+
37
+ elsif level == 8
38
+ @question = "#{a} x #{b} + #{c} -#{d}"
39
+ @answer = a * b + c -d
40
+
41
+ elsif level == 9
42
+ @question = "#{a} x #{b} x #{c} + #{d}"
43
+ @answer = a * b * c + d
44
+
45
+ elsif level == 10
46
+ @question = "#{a} + #{b} + #{c} +#{d} x #{e}"
47
+ @answer = a + b + c *d - e
48
+
49
+ end
50
+
51
+ return @question
52
+ end
53
+
54
+ def self.checkAnswer(user_answer)
55
+
56
+ if user_answer.to_i == @answer.to_i
57
+ @check = "You Got it Right"
58
+ else
59
+ @check = "You Got it Wrong"
60
+ end
61
+
62
+ return @check
63
+ end
64
+
65
+ def self.sendQuestion
66
+ return "#{@question} = #{@answer}"
67
+ end
68
+ end
metadata ADDED
@@ -0,0 +1,43 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rsrrubyquestions
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - RSR
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-02-25 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A simple gem
14
+ email: reynaldo.s.reyes.gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/rsrrubyquestions.rb
20
+ homepage: http://rubygems.org/gems/createquestion
21
+ licenses: []
22
+ metadata: {}
23
+ post_install_message:
24
+ rdoc_options: []
25
+ require_paths:
26
+ - lib
27
+ required_ruby_version: !ruby/object:Gem::Requirement
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ version: '0'
32
+ required_rubygems_version: !ruby/object:Gem::Requirement
33
+ requirements:
34
+ - - ">="
35
+ - !ruby/object:Gem::Version
36
+ version: '0'
37
+ requirements: []
38
+ rubyforge_project:
39
+ rubygems_version: 2.2.2
40
+ signing_key:
41
+ specification_version: 4
42
+ summary: Create Questions
43
+ test_files: []