Convert this Python code into Ruby. class BankAccount: def __init__(self, aBalance=0): self._currentBalance = aBalance; def deposit(self, amount): self._currentBalance =self._currentBalance+amount def withdraw(self, amount): self._currentBalance = self._currentBalance-amount def getCurrentBalance(self): return self._currentBalance anAccount = BankAccount(5) anAccount.withdraw(5) print(anAccount.getCurrentBalance())

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter4: More Object Concepts
Section: Chapter Questions
Problem 5RQ
icon
Related questions
Question

Convert this Python code into Ruby.

class BankAccount: def __init__(self, aBalance=0): self._currentBalance = aBalance; def deposit(self, amount): self._currentBalance =self._currentBalance+amount def withdraw(self, amount): self._currentBalance = self._currentBalance-amount def getCurrentBalance(self): return self._currentBalance anAccount = BankAccount(5) anAccount.withdraw(5) print(anAccount.getCurrentBalance())

Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Top down approach design
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT