ABC Bank announced a new scheme of reward points for a transaction using an ATM card. Each transaction using the normal card will be provided 1% of the transaction amount as a reward point. If a transaction is made using a premium card and it is for fuel expenses, additional 10 points will be rewarded. Write a java program to calculate the total reward points. [Note: Strictly adhere to the object-oriented specifications given as a part of the problem statement. Follow the naming conventions as mentioned] Consider a class VISACard with the following method.
ABC Bank announced a new scheme of reward points for a transaction using an ATM card. Each transaction using the normal card will be provided 1% of the transaction amount as a reward point. If a transaction is made using a premium card and it is for fuel expenses, additional 10 points will be rewarded. Write a java program to calculate the total reward points.
[Note: Strictly adhere to the object-oriented specifications given as a part of the problem statement.
Follow the naming conventions as mentioned]
Consider a class VISACard with the following method.
Method | Description |
public Double computeRewardPoints(String type, Double amount) | This method returns the 1% of the transaction amount as reward points |
Consider a class HPVISACard which extends VISACard class and overrides the following method.
Method | Description |
public Double computeRewardPoints(String type, Double amount) | In this method, calculate the reward points from the base class and add 10 points if it is for fuel expense |
Hint:
Use super keyword to calculate reward points from base class.
Consider the Main class with the main method and read all the transaction details in the main method.
Card type will be either ‘VISA card’ or ‘HPVISA card’. Otherwise, display ‘Invalid data’
Calculate the reward points corresponding to the card type and transaction type and print the reward points(upto two decimal places).
The link to download the template code is given below
Code Template
Step by step
Solved in 5 steps with 3 images