[java]代码库
package two;
import java.util.Scanner;
public class Two8 {
public static void main(String[] args) {
System.out.println("MyShopping管理系统>购物结算\n");
System.out.println("..........................");
System.out.println("请选择购买的商品编号:");
System.out.println("1.T恤 2.网球鞋 3.网球拍");
System.out.println("..........................");
Scanner input=new Scanner(System.in);
String num = input.next();
{
while("1" .equals(num)){
System.out.println("1.T恤 ¥245.0");
System.out.println("是否继续(Y/N)");
num=input.next();
}
while("2" .equals(num)){
System.out.println("2.网球拍 ¥195.0");
System.out.println("是否继续(Y/N)");
num=input.next();
}
while("3" .equals(num)){
System.out.println("3.网球拍 ¥279.0");
System.out.println("是否继续(Y/N)");
num=input.next();
}
}while("N" .equals(num)){
System.out.println("结束程序!");
num=input.next();
}
}