Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java Code:- Credit cards with inheritance We would like to design a class that stores information about a debit card. Since debit cards

Write a Java Code:-

image text in transcribed

image text in transcribed

Credit cards with inheritance We would like to design a class that stores information about a debit card. Since debit cards and credit cards have a lot of similarity, the commonality can be extracted to a superclass called ChargeCard. Then DebitCard and CreditCard are both subclasses of ChargeCard. A fundamental difference between credit cards and debit cards is in how they make purchases but realize that they both have the capacity to make purchases. A purchase increases the balance of a credit card while it decreases the balance of a debit card. Some distinctions between a credit card and a debit card lie in how the user makes payments towards them. The bill can be paid on a CreditCard to decrease its balance while a deposit or withdrawal can affect the balance of a DebitCard. A credit card has a spending limit to limit the balance on the card. Purchases can be made on a debit card as long as there are funds in the account. The balance on a debit card can become negative, so long as the amount does not exceed the overdraft limit, in which case an overdraft fee is applied. ChargeCard CreditCard DebitCard Do you think ChargeCard should be an abstract or a concrete class? Write a comment before the class begins in which you explain your design decision Make a parameterized constructor in the superclass that can be called from all of its subclasses. Keep in mind: input and output should not be performed in the CreditCard or DebitCard or ChargeCard classes. All input and output to the user should be performed in the main method method (or other methods that are in a separate class) to increase flexibility of the classes we will design later on

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

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

Draw the shear and bending-moment diagrams for thebeam. 300 N/m

Answered: 1 week ago