零食

题目 零食

image-79e1d7fb

思路分析

代码实现

import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int x=sc.nextInt(),y=sc.nextInt();
        switch(x){
            case 1:
                System.out.printf("Total: R$ %.2f\n",4.00*y);
                break;
            case 2:
                System.out.printf("Total: R$ %.2f\n",4.50*y);
                break;
            case 3:
                System.out.printf("Total: R$ %.2f\n",5.00*y);
                break;
            case 4:
                System.out.printf("Total: R$ %.2f\n",2.00*y);
                break;
            case 5:
                System.out.printf("Total: R$ %.2f\n",1.50*y);
                break;
        }
    }
}

同类题型

视频讲解


项目分区导航游戏时间 ⬅️ | 05-零食 | ➡️ 循环语句