7. Instantiation Nation, what do I miss?


#1

Hello !

There is my code for this exercise :


class Computer
@@users = {}
def Computer.get_users
return @@users
end

def create (filename)
    time = Time.now
    @file [filename] = time
    puts "#{filename} was creted by #{username}"
end

def initialize (username, password)
    @username = username
    @password = passord
    @files = {}
    @@users[username] = password
end

end
my_computer = Computer.new("Seb", 2345)


I really don't understand what I'm doing wrong, maybe you could give me a hint ! :slightly_smiling:

Thank you very much !


#2

try
end
my_computer = Computer.new("Seb", "2345")


#3

Getting the same.

The IDE continues to say: "Did you create a variable called my_computer?" even thought I've already created it. I don't know what's the problem.

Codeacademy is very good, but this IDE is a pain in the ■■■!!


#5

Hi, you're leaving some spaces between the methods and the parameters it takes, as well as spaces in between your @instance variables and the hashes. That might be influencing on the response codecademy is giving you.

This worked for me:

class Machine
@@users = {}

def initialize(username, password)
@username = username
@password = password
@@users[username] = password
@files = {}
end

def create(filename)
time = Time.now
@files[filename] = time
puts "#{filename} was created by #{@username} at #{time}."
end

def Machine.get_users
@@users
end
end