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:
foreignFeeRate of double type,
and domesticBonusMileageRate of double type.
Provide:
default constructor with no parameters,
constructor with all parameters to initialize its own private data and the inherited data from CreditCard
gettersetter methods for each data member
There are two effector methods:
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 $ and under a foreignFeeRate of then the extra fee is calculated by multiplying $ of foreign spending with of foreignFeeRate, which yields $ $ so the total fee is $ $ $
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 miles, and if the domesticBonusMileageRate is then the bonus mileage is calculated by multiplying $ of domestic spending with domesticBonusMileageRate which yields miles. Then the total mileage award is miles.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
