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

📄 chapter4n1d.java

📁 JAVA源代码程序aashjkjhkjhkjhjkhkj
💻 JAVA
字号:
/* * program to demonstrate a more complicated "switch" statement */import java.lancs.* ;public class Chapter4n1d    {    /*     * main     */    public static void main(String[] args) throws Exception	{	BasicIo.prompt("type the first operand: ") ;	int operand1 = BasicIo.readInteger() ;	BasicIo.prompt("type an operator (+, -, * or /): ") ;	char operator = BasicIo.readCharacter() ;	BasicIo.prompt("type the second operand: ") ;	int operand2 = BasicIo.readInteger() ;	int result = 0 ;	switch (operator)	    {	    case '+' :		result = operand1 + operand2 ;		break;	    case '-' :		result = operand1 - operand2 ;		break;	    case '*' :		result = operand1 * operand2 ;		break;	    case '/' :		result = operand1 / operand2 ;		break;	    default :		System.out.print("illegal operator") ;	     } ;	System.out.println("the result is " + result) ;	} // end of method main    } // end of class Chapter4n1d

⌨️ 快捷键说明

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