Learn

Perfect! Now let’s tackle the first public method, display_balance, which we’ll use to display our current account balance.

Instructions

1.

Define a public display_balance method to your Account class. It should take a single parameter, pin_number.

The body of your method should check whether the pin_number is equal to pin (the result of calling the private pin method)

If it is, display_balance should puts "Balance: $#{@balance}."

Otherwise (else), it should puts pin_error (the pin_error message).

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?