Virtual Computer Exercise


#1

Hi there,

I have my code written out:
class Computer
@@users = {}
def initialize(username, password)
@username = username
@password = password
@files = {}
@@users[username] = password
end

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

def Computer.get_users
    @@users
end

end

my_computer = Computer.new("user123", 12345)

It says that it is correct the whole way through but it doesn't print anything out in the console. It only prints out "nil" or #. Is this supposed to happen or do I have to write more code to get it to print out the same as the example in the beginning? I tried copying the rest of the code from the beginning example and changed minor bits to make it work but it prints out an error message.

Thanks


#2

You've created an instance of your class. Should that cause anything to be printed?

Which part of your code prints something? When does that part execute, what does one need to do to execute that?