Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 0 . 1 P | Fix it - Sort Records Challenge ( D ) Submissions Description data.txt fix _ it . rb 1 0

10.1P | Fix it - Sort Records
Challenge
(D) Submissions
Description
data.txt
fix_it.rb
10.1P Fix it Sort Records
In this task you will build on the debugging skills developed in your other Pass and Tutorial tasks.
TIP: There are 3 errors in the code two are typing (syntax) errors, one is a logic error.
Your program should produce the following output:
[useresahara -]$ ruby fix fic,rb
first line: 6
Line read: Fred
Line read: Jill
Line read: Johnny
Line read: Sam
Line read: Sam
1 Class MyRecord
attr_accessor :name, :age
def initialize(name, age)
aname = name
@age = age
end
8 end
def compare(a,b, direction)
if direction
32a>b
43 else
=+4,a
15 end
16 end
7
18 def sort(arr, direction)
itemcount = arr. length?h
omefixit.rb Spaces: 2(Auto)
Console
Terminal
Run
Mark
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions