Add a new class checkingAccount that inherits from the BankAccount class, and has a double instance variable overdraft Limit in addition to the variables inherited from the superclass. • Create a constructor for the checking Account class that takes in the account number, account holder name, initial balance, account type and overdraft limit as input, and uses the super keyword to call the constructor of the superclass, passing in the account number, account holder name and initial balance, account type. • Re-write the withdraw() method in the checkingAccount class so that it first checks if the withdrawal amount is less than the current balance plus the overdraft limit. If it is, the withdrawal is allowed and the balance is updated. If not, the method should return an error message "Insufficient funds". • Create a new method displayOverdraft Limit() that returns the overdraft limit of the CheckingAccount . • In the BankAccountTest class, create a new object of type Checking Account with account number 12345, account holder name "John Doe", initial balance $1000, account type as CHECKING i You will need to use the concepts of inheritance and the super keyword. Re-writing a method from parent class in a child class is called Method Overriding. We will discuss the details of Polymorphism in future sessions.
Add a new class checkingAccount that inherits from the BankAccount class, and has a double instance variable overdraft Limit in addition to the variables inherited from the superclass. • Create a constructor for the checking Account class that takes in the account number, account holder name, initial balance, account type and overdraft limit as input, and uses the super keyword to call the constructor of the superclass, passing in the account number, account holder name and initial balance, account type. • Re-write the withdraw() method in the checkingAccount class so that it first checks if the withdrawal amount is less than the current balance plus the overdraft limit. If it is, the withdrawal is allowed and the balance is updated. If not, the method should return an error message "Insufficient funds". • Create a new method displayOverdraft Limit() that returns the overdraft limit of the CheckingAccount . • In the BankAccountTest class, create a new object of type Checking Account with account number 12345, account holder name "John Doe", initial balance $1000, account type as CHECKING i You will need to use the concepts of inheritance and the super keyword. Re-writing a method from parent class in a child class is called Method Overriding. We will discuss the details of Polymorphism in future sessions.
Chapter10: Introduction To Inheritance
Section: Chapter Questions
Problem 20RQ
Related questions
Question

Transcribed Image Text:Add a new class checkingAccount that inherits from the BankAccount class, and has a double
instance variable overdraft Limit in addition to the variables inherited from the superclass.
• Create a constructor for the checking Account class that takes in the account number, account
holder name, initial balance, account type and overdraft limit as input, and uses the super
keyword to call the constructor of the superclass, passing in the account number, account holder
name and initial balance, account type.
• Re-write the withdraw() method in the checkingAccount class so that it first checks if the
withdrawal amount is less than the current balance plus the overdraft limit. If it is, the withdrawal
is allowed and the balance is updated. If not, the method should return an error message
"Insufficient funds".
• Create a new method displayOverdraft Limit() that returns the overdraft limit of the
CheckingAccount .
• In the BankAccountTest class, create a new object of type Checking Account with account number
12345, account holder name "John Doe", initial balance $1000, account type as CHECKING
i
You will need to use the concepts of inheritance and the super keyword. Re-writing a
method from parent class in a child class is called Method Overriding. We will discuss the
details of Polymorphism in future sessions.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps

Recommended textbooks for you

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning

Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage

EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT

C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr