7. let me pass but nothing comes up except a # why?


#1



7 why does my code not print anything


does not print username and password

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 "You just created a new file, #{filename} at #{time}!"
    end    
 def Computer.get_users
    @@users
  end
end
my_computer = Computer.new("Buffetyy", 301728)
 print Computer


#2

You want to print the username and password, you are currently trying to print a class Computer.

You created a Computer object when you declared

my_computer = Computer.new("Buffetyy", 301728)

That line of code created a Computer called my_computer with a username of Buffetyy and a pass word of 301728

Try referencing your Computer object and calling on its methods to display the data you want.

it will look something like this
my_computer_object.a_method_Computer_objects_know


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.