Question: java Code a subclass named ExpressCard that inherits from the superclass CreditCard, which has two private data members: 1 . foreignFeeRate of double type, 2

java
Code a subclass named ExpressCard that inherits from the superclass CreditCard, which has two private data members:
1. foreignFeeRate of double type,
2. and domesticBonusMileageRate of double type.
Provide:
1. default constructor with no parameters,
2. constructor with all parameters to initialize its own private data and the inherited data from CreditCard
3. getter/setter methods for each data member
There are two effector methods:
1. Method calcFee() takes no parameters and it returns double type.
a. This method calculates the transaction fee.
b. First you need to call the method in superclass to obtain the basic fee, and then for ExpressCard user, there is an extra charge for foreign spending.
c. Given the same example above as in class CreditCard, the basic fee is $3, and under a foreignFeeRate of 3%, then the extra fee is calculated by multiplying $50 of foreign spending with 3%(0.03) of foreignFeeRate, which yields $50*0.03= $1.5, so the total fee is $3+ $1.5= $4.5.
2. Method calcMileage() takes no parameters and it returns double type.
a. This method calculates the mileage award.
b. First you need to call the method in superclass to obtain the basic mileage, then there is a bonus mileage award for domestic spending under a rate of domesticBonusMileageRate.
c. Given the same example as in class CreditCard, the basic mileage award is 7.5 miles, and if the domesticBonusMileageRate is 4%(0.04), then the bonus mileage is calculated by multiplying $100 of domestic spending with domesticBonusMileageRate 0.04, which yields 4 miles. Then the total mileage award is 7.5+4=11.5 miles.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!