Calculate Reward Points 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 Input and Output Format: Refer sample input and output for formatting specifications. Enter the transaction details in CSV format ( Transaction type, amount, card type) All text in bold corresponds to the input and the rest corresponds to output. Sample Input and Output 1: Enter the transaction detail Shopping,5000,VISA card Total reward points earned in this transaction is 50.00 Do you want to continue?(Yes/No) Yes Enter the transaction detail Fuel,5000,HIVISA card Invalid data Do you want to continue?(Yes/No) Yes Enter the transaction detail Fuel,5000,HPVISA card Total reward points earned in this transaction is 60.00 Do you want to continue?(Yes/No) No Sample Input and Output 2: Enter the transaction detail Fuel,1000,HPVISA card Total reward points earned in this transaction is 20.00 Do you want to continue?(Yes/No) No

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 14RQ
icon
Related questions
Question
Calculate Reward Points


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

Input and Output Format:

Refer sample input and output for formatting specifications.
Enter the transaction details in CSV format ( Transaction type, amount, card type)

All text in bold corresponds to the input and the rest corresponds to output.

Sample Input and Output 1:

Enter the transaction detail
Shopping,5000,VISA card
Total reward points earned in this transaction is 50.00
Do you want to continue?(Yes/No)
Yes
Enter the transaction detail
Fuel,5000,HIVISA card
Invalid data
Do you want to continue?(Yes/No)
Yes
Enter the transaction detail
Fuel,5000,HPVISA card
Total reward points earned in this transaction is 60.00
Do you want to continue?(Yes/No)
No

Sample Input and Output 2:

Enter the transaction detail
Fuel,1000,HPVISA card
Total reward points earned in this transaction is 20.00
Do you want to continue?(Yes/No)
No

 

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT