Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Help with my beginner\'s Ruby code. 1 gradebook Hash.new 3 5.times do 4 puts \"E

ID: 3590917 • Letter: H

Question


Help with my beginner's Ruby code.

1 gradebook Hash.new 3 5.times do 4 puts "Enter the students name:" 5 name [x] -gets.chomp.to-s Instructions from your teacher Finish writing the gradebook program. It should accept a name and grade 5 times. 7 puts "Enter the students grade:" Then it should spit out the names and grades in this format Eric: 100 Whoever: 20 8 grade [x]- gets.chomp.toi 9 10. #enter the grade in the gradebook under the students name 12 13 end 14 15- #print out each name and grade in the gradebook 16 #Eric: 100 17 ruby 2.3.1p112 (2016-04-26 revision 54768) (x86_64- linux]

Explanation / Answer


STDOUT.flush  

#initialized i=0 and counter till 5 input

$i = 0

$num = 5


while $i < $num do

name=gets.chomp
# gets name
values1 = []
values1.push(name)

grade=gets.chomp
# gets grade


values1.push(grade)

string_value = values1.join(":")
puts string_value


print " "
end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote