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

Please make the necessary changes within the class structures, as right now they

ID: 3776567 • Letter: P

Question

Please make the necessary changes within the class structures, as right now they both just state :I have to stay home!. Simply writing a series of puts commands will be incorrect.

Here's the current code I have:

class Rookie
@@bling=0

def initialize(id, name)
   @id=id
   @name=name
   @food=5
   @bling=0
end

def weekend
   if @@bling<5
   puts "I have to stay home!"
   else
   puts "Let's Party!"
   end
end
end

class Level2
@@bling=10
def initialize(id, name)
   @id=id
   @name=name
   @food=5
   @bling=10
end
end
player1=Rookie.new("1", "Mary")
player2=Rookie.new("2", "Paul")

print "Mary says: "
player1.weekend
print "Paul says: "
player2.weekend

Mary says Let's Party! Paul says I have to stay hone

Explanation / Answer

class Rookie
@@bling=0
def initialize(id, name)
@id=id
@name=name
@food=5
@bling=0
end
def weekend
if @@bling<5
puts "I have to stay home!"
else
puts "Let's Party!"
end
end
end
class Level2
@@bling=10
def initialize(id, name)
@id=id
@name=name
@food=5
@bling=10
end
def weekend
if @@bling<5
puts "I have to stay home!"
else
puts "Let's Party!"
end
end
end
player1=Level2.new("1", "Mary")
player2=Rookie.new("2", "Paul")
print "Mary says: "
player1.weekend
print "Paul says: "
player2.weekend

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