用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字

小鱼宝宝    -  云代码空间

——

s

2017-05-24|1014阅||

摘要:SADA

t java.util.*;
public class UserInterface
{
    public static void main(String args[]){
        Cards card0 = new Cards();
        Cards card1 =new SavingsCard();
        Cards card2 =new CreditCard();
        int k=-1;
        Scanner scan = new Scanner(System.in);
        Scanner scan0 = new Scanner(System.in);
        Scanner scan1 = new Scanner(System.in);
        Scanner scan2 = new Scanner(System.in);
        do{
            System.out.println("银行卡管理系统");
            System.out.println("1.开卡");
            System.out.println("2.存款");
            System.out.println("3.取款");
            System.out.println("4.查询余额");
            System.out.println("0.退出系统");
            System.out.println("请输入:");
            k = scan.nextInt();
            switch(k){
                case(1):{
                    System.out.println("请输入开卡类型:\n1.储蓄卡\n2.信用卡");
                    int j;
                    j = scan0.nextInt();
                    switch(j){
                        case(1):{
                            card0 = card1;
                            System.out.println("您已开通储蓄卡!");
                            break;
                        }
                        case(2):{
                            card0 = card2;
                            System.out.println("您已开通信用卡!");
                            break;
                        }
                        default:{
                            System.out.println("非法输入。");
                            break;
                        }
                    }
                    break;
                }
                case(2):{
                    System.out.println("请输入存款金额:");
                    card0.saveMoney(scan1.nextDouble());
                    break;
                }
                case(3):{
                    System.out.println("请输入取款金额:");
                    card0.takeMoney(scan2.nextDouble());
                    break;
                }
                case(4):{
                    System.out.println("账户余额为:"+card0.getBalance());
                    break;
                }
                case(0):{
                    break;
                }
                default:{
                    System.out.println("非法输入。");
                }
            }
        }while(k!=0);
顶 0踩 0收藏
文章评论
    发表评论

    个人资料

    • 昵称: 小鱼宝宝
    • 等级: 初级程序员
    • 积分: 18
    • 代码: 2 个
    • 文章: 15 篇
    • 随想: 0 条
    • 访问: 8 次
    • 关注

    人气文章

    人气代码

    最新提问

      站长推荐