⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p65课堂实践.txt

📁 JAVA ATA认证课本
💻 TXT
字号:

import java.util.Scanner;

public class ZuoYe {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		      int weight;
        	  float price;
        	  float sum;
        	  price=50.0f;
        	  System.out.println("原价:"+price+"元/磅。");
        	  System.out.println("\n 请输入冰激凌蛋糕的重量(磅):");
        	  Scanner sacnner=new Scanner(System.in);
        	  weight=sacnner.nextInt();
        	  switch(weight){
        	  case 1:
        		  System.out.print("\n 输入重量为"+weight+"磅,不能享受优惠.");
        		  break;
        	  case 2: price=(float)(price*0.9);
        		  System.out.print("\n 输入重量为 "+weight+"磅,能享受9折优惠,打折后价格:"+price+"元/磅.");
        		  break;
        	      default: price=(float)(price*0.8);
        		  System.out.print("\n 输入重量为"+weight+"磅,能享受8折优惠,打折后价格:"+price+"元/磅");
        		  	
        	  } 
        	  sum=price*weight;
    	      System.out.print("\n 应收金额为:"+sum+" 元.");
          }	    

	}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -