Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PART B- OOP Bank transaction using Inheritance and Polymorphism Create a class and name it Account that a bank might use to represent the client

image text in transcribed

PART B- OOP Bank transaction using Inheritance and Polymorphism Create a class and name it Account" that a bank might use to represent the client bank account. You must include an account number, the client name as String and a float data member to represent the balance inside that account. Add a default constructor that assigns a default account number, a default client name and an initial amount used to initialize the balance. Use setter and getter methods to set and get the balance. In addition, add a method to calculate the balance inside the account. Two derived classes "Debit Card" and "Credit Card" are created respectively where the calculated balance differs between the two classes. The "Debitcard" class has a double data member named debit which allows the client only to withdraw money from his balance (usually his monthly salary). On the other hand, the "Credit Card" class has two double data members debit and credit which allows the client either to withdraw money or to add money to his balance, as well as a monthly interest is added to his actual balance. In addition, you must use the appropriate setter and getter methods for both derived classes. Write a driver that will instantiates objects from these two derived classes and store it into an array of the super class type. The program must implement polymorphism to be able to call the appropriate method that calculates the current balance at run time with respect to the current object being in use. On the other hand, it will add 50$ to the balance of the customers who hold a "Creditcard

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Databases With PostgreSQL From Novice To Professional

Authors: Richard Stones, Neil Matthew

2nd Edition

1590594789, 978-1590594780

More Books

Students also viewed these Databases questions

Question

=+ f. instituting laws against driving while intoxicated

Answered: 1 week ago

Question

=+ Why have these changes occurred?

Answered: 1 week ago