# Step 1: Define a class named "Person"
class Person
# Step 2: Define getter and setter methods for the "name" attribute
attr_accessor :name
# Step 3: Define the constructor method with a parameter for the person's name
def initialize(name)
# Step 4: Set the instance variable "@name" with the provided name
@name = name
end
# Step 5: Define a method named "greet" to display a greeting message
def greet
# Step 6: Use the "#{@name}" variable to include the person's name in the greeting
puts "Hello, #{@name}!"
end
end
# Step 7: Create a new instance of the "Person" class with the name "John"
person = Person.new("John")
# Step 8: Call the "greet" method on the created person instance
person.greet