public class 蛋糕店 {
public static void main (String args[ ]){
System.out.println("请问你想购买蛋糕么?");
Scanner input=new Scanner(sysytem.in);
int i=input.nexInt();
switch(i)
{ case 1:System.out.println("一块蛋糕3元!"); break;
case 2:System.out.println("两块蛋糕5.5元!"); break;
case 3:System.out.println("三块蛋糕8元!");break;
default:System.out.println("四块蛋糕及以上2元一块!");
break;
}
}
}
我这里只能做到这块。新手不会弄。要求实现的就是一个能循环的,而且可以初步实现售和卖这一块,能计算共买了几块,然后把总价给计算出来。求各位给解说下。。。









