import java.util.*;
class VISACard{
    public Double computeRewardPoints(String purchaseType, Double amount){
        double res=amount*(1/100d);
        return res;
    }
}
class HPVISACard{
    public Double computeRewardPoints(String purchaseType, Double amount){
        double res=amount*(1/100d);
        if(purchaseType.equals("fuel")){
            res=res+10;
        }
        return res;
    }
}
public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        String holdername=sc.nextLine();
        String acc=sc.nextLine();
        double amount=sc.nextDouble();
        sc.nextLine();
        String purchaseType=sc.nextLine();
        int choice=sc.nextInt();
        if (choice==1){
            VISACard obj=new VISACard();
            System.out.println(obj.computeRewardPoints(purchaseType,amount));
        }else if(choice==2){
            HPVISACard obj=new HPVISACard();
            System.out.println(obj.computeRewardPoints(purchaseType,amount));
        }
        else{
            System.out.println("Invalid choice");
        }
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: