Virtual Computer 8/8

Hi guys question about this exercise. Anyone who manage to do the update and delete methods? I only manage to do the additional parameters.

Here is my code:

class Computer
  @@users = {}
	def initialize(username, password, first_name)
    @@users[username] = password
    #@@users hash keeps usernames as keys with each username's password as the associated value.
    @username = username
    @password = password
    @first_name = first_name
    @files = {}
  def create(filename, filename_2)
  	time = is the current time
    @files[filename] = time
    @files[filename_2] = time
    puts "A new file was created files: #{filename} and #{filename_2}, username: #{@username}, time: #{time}, name: #{@first_name}"
  def Computer.get_users

my_computer ="hermanomark", 123456, "Mark")

my_computer.create("journal.txt", "journal.jpeg")

puts "Users: #{Computer.get_users}"

=> A new file was created files: journal.txt and journal.jpeg, username: hermanomark, time: 2018-06-03 16:13:53 +0000, name: Mark
Users: {"hermanomark"=>123456}

Update and delete would be very similar to create, using that as reference should make this an easy task.

If it’s not, and it very well might not be, then identifying what stops you is a good start.

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