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

Ruby Code. Need at least a rough outline of a ruby program that does the followi

ID: 3870972 • Letter: R

Question

Ruby Code. Need at least a rough outline of a ruby program that does the following:

In a loop, the program will prompt the user (which is you) for a series of values which you will store in a Hash. As you start a new record, add the employee ID as a Fixnum to the Hash to act as the key. The value stored will be an Array. By the end of the series of prompts, the program will have added the full record to a Hash. It will then ask if you want to enter another user record. If you answer "yes" or "Y" the program continues to prompt for the next record. If you enter anything other than "yes" or "Y" it will move to the next phase, which is to print a summary of all user records created in this run of the program.

Output should be similar to the following:

Enter the user's employee id: 589

Enter the user's first name: John

Enter the user's last name: Smith

Enter the user's department number: 42

Enter the user's supervisor (full name): Hank Jones

Enter the user's Linux account ID: smithj1

Enter the user's temporary password: H0lyM0$es

Would you like to create another record (type yes or Y to continue): Y

Enter the user's employee id: 472

Enter the user's first name: Jane

Enter the user's last name: Doe

Enter the user's department number: 54

Enter the user's supervisor (full name): Art Tatum

Enter the user's Linux account ID: doej1

Enter the user's temporary password: $ecrEtW0rd

Would you like to create another record (type yes or Y to continue): Y

Enter the user's employee id: 467

Enter the user's first name: John

Enter the user's last name: Doe

Enter the user's department number: 42

Enter the user's supervisor (full name): Hank Jones

Enter the user's Linux account ID: doej2

Enter the user's temporary password: 0bfu$c8tion

Would you like to create another record (type yes or Y to continue): N

Summary

=============================

3 records created:

Name: John Smith

Employee Id: 589

Department: 42

Supervisor: Hank Jones

Username: smithj1

Password: H0lyM0$es

Name: Jane Doe

Employee Id: 472

Department: 54

Supervisor: Art Tatum

Username: doej1

Password: $ecrEtW0rd

Name: John Doe

Employee Id: 467

Department: 42

Supervisor: Hank Jones

Username: doej2

Password: 0bfu$c8tion

Explanation / Answer

empid = [] #Employee id
fname = [] #fname - first name
lname = [] #lname - last name
deptno =[] #deptno - department number
sfn   = [] #sfn - supervisor full name
lid   = [] #lid - linux user id
tpwd = [] #tid - temporary password

cnt=0
ch='y'
while ch=='Y' || ch=='yes

while true
puts "Enter the user's emppolyee id : "
empid[cnt]=gets.chomp
puts "Enter the user's first name : "
fname[cnt]= gets.chomp
puts "Enter the user's last name : "
lname[cnt]= gets.chomp
puts "Enter the user's department number : "
deptno[cnt]=gets.chomp
puts "Enter the user's supervisor(full name) : "
sfn[cnt]= gets.chomp
puts "Enter the user's Linux account ID : "
lid[cnt] = gets.chomp
puts "Enter the user's temporary password : "
tpwd[cnt] = gets.chomp

cnt+=1      # cnt = cnt = 1 for the purpose of increment array index

puts "Would you like to create another record (type yes or Y to continue) : "
ch=gets.chomp
if (ch.length!=1 && ch.downcase != 'yes') || ch!='Y'
break
end

puts "Summary"
puts "======================================="
for i in 0..cnt
puts "Name : " + fname[i] + lname[i]
puts "Emppolyee id : " + empid[i]
puts "Department : " + deptno[i]
puts "Supervisor : " + sfn[i]
puts "Username : " + lid[i]
puts "Password : " + tpwd[i]
end