2021-03-19

package edu.xcdq;

import jdk.nashorn.internal.ir.SwitchNode;

import java.util.Scanner;

public class Demo01 {

public static  void main(String[] args){

System.out.println("购物管理系统>购物结算");

        System.out.println("*************************");

        System.out.println("请选择购买的商品编号:");

        System.out.println("1. T恤\t\t\t 2. 网球鞋\t\t\t3.网球拍");

        System.out.println("*************************");

        String shifoujixu="";

        do {

System.out.println("请输入商品编号:");

            Scanner scanner =new Scanner(System.in);

            int bianhao = scanner.nextInt();

            switch (bianhao){

case 1:

System.out.println("T恤\t\t\t¥245,0");

break;

                case 2:

System.out.println("网球鞋\t\t\t¥45,0");

break;

                case 3:

System.out.println("网球拍\t\t\t¥25,0");

break;

            }

System.out.println("是否继续(y/n)");

            shifoujixu = scanner.next();

        }while ("y".equals(shifoujixu));

    }

}

你可能感兴趣的:(2021-03-19)