import java.util.Scanner;

/**
 * 模拟支付平台,显示出通过某某支付付款xx金额
 */
//测试类
public class test {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        System.out.println("请选择支付方式:1.支付平台支付 2.银行卡支付  3.信用卡支付");
        int statistics= sc.nextInt();
        Payment payment=null;
        switch (statistics){
            case 1:
                payment=new PaymentPlatform();
                break;
            case 2:
                payment=new CardPayment();
                break;
            case 3:
                payment=new CreditCardsPayment();
                break;
        }
        System.out.println("请输入你的支付金额:");
        double money= sc.nextDouble();
        payment.pay(money);
    }
}
//定义一个支付接口
public interface Payment {
    void pay(double money);
}
//实现类,重写接口方法
public class PaymentPlatform implements Payment{
    @Override
    public void pay(double money) {
        System.out.println("通过支付平台支付了"+money+"元");
    }
}
//实现类,重写接口方法
public class CardPayment implements Payment{
    @Override
    public void pay(double money) {
        System.out.println("通过银行卡支付了"+money+"元");
    }
}
//实现类,重写接口方法
public class CreditCardsPayment implements Payment{
    @Override
    public void pay(double money) {
        System.out.println("通过信用卡支付了"+money+"元");
    }
}