首页 > 其他分享 >Method Dmeo06

Method Dmeo06

时间:2023-10-25 16:46:07浏览次数:34  
标签:case Dmeo06 num1 num2 System out Method scanner

package com.chen.method;

import java.util.Scanner;

public class Demo06 {
public static void main(String[] args) {
int i = 1;

while (i >0){
//输入
Scanner scanner = new Scanner(System.in);
//值1
double num1 = scanner.nextDouble();

//输入符号
String symbol = scanner.next();

//值2
double num2 = scanner.nextDouble();

switch (symbol) {
case "+":
System.out.println(num1 + num2);
break;
case "-":
System.out.println(num1 - num2);
break;
case "*":
System.out.println(num1 * num2);
break;
case "/":
System.out.println(num1 / num2);
break;
}
}

}
}

标签:case,Dmeo06,num1,num2,System,out,Method,scanner
From: https://www.cnblogs.com/jingyichenloveningning/p/17787561.html

相关文章

  • Method Dmeo05
    packagecom.chen.method;publicclassDemo05{publicstaticvoidmain(String[]args){Demo05demo05=newDemo05();System.out.println(f(5));}publicstaticintf(inti){if(i==1){return1;......
  • Method Demo02
    packagecom.chen.method;publicclassDemo02{publicstaticvoidmain(String[]args){doublesum=sum(1.0,1.0);System.out.println(sum);}//比大小publicstaticdoublesum(doublea,doubleb){doubleresult=0;......
  • Method Demo01
    packagecom.chen.method;publicclassDemo01{//main方法publicstaticvoidmain(String[]args){intsum=add(1,2,3);System.out.println(sum);//test();}//加法publicstaticintadd(inta,intb){returna+......
  • 【PowerShell】Invoke-WebRequest和Invoke-RestMethod
    ##PublicfreeRestfulAPIURL ##https://documenter.getpostman.com/view/8854915/Szf7znEe#intro#Example01#--------------------------------------------------------------$url="https://cat-fact.herokuapp.com/facts/"$r=Invoke-WebReques......
  • IDEA 出现 Cannot resolve method getParameter() in JSP 解决方法
    原链接java-CannotresolvemethodgetParameter()inJSP-StackOverflowIDEA中出现下图情况,版本IDEA2022.2.3。此方法大概率可用,如果帮到你请点个赞吧~  1.我们右键当前项目,选择进入"OpenModuleSettings",如下图2.进入下图界面后,点击下图加号弹出二级菜单,在通......
  • [914] In Python's datetime library, you can format dates using the strftime() me
    InPython'sdatetimelibrary,youcanformatdatesusingthestrftime()method.Thismethodallowsyoutocreateaformattedstringrepresentationofadatetimeobject,specifyingtheformatyouwant.Here'showyoucanformatadateusingstrft......
  • Program does not contain a static 'Main' method suitable for an entry point
    http://www.kangry.net/blog/?article_id=391&type=article修改办法,对着项目右键-》属性-》application-》outputtype设为ClassLibrary即可。  ......
  • [905] The replace() method in Pandas
    InPandas,thereplace()methodisusedtoreplacevaluesinaDataFrameorSeries.Youcanusethismethodtoreplaceoneormorespecifiedvalueswithothervalues.Here'showyoucanuseit:Syntax:DataFrame.replace(to_replace,value,inplace=Fal......
  • 核方法(kernel method)的主要思想
    本文对核方法(kernelmethod)进行简要的介绍(https://www.jianshu.com/p/8e2649a435c4)。核方法的主要思想是基于这样一个假设:“在低维空间中不能线性分割的点集,通过转化为高维空间中的点集时,很有可能变为线性可分的”,例如下图   左图的两类数据要想在一维空间上线性分开......
  • 类里面静态方法(@staticmethod),类方法(@classmethod)和实例方法(self)的使用与区别
    前言python类里面常用的方法有3个:静态方法(@staticmethod),类方法(@classmethod)和实例方法(self)本篇讲解这3种方法在使用上有什么区别。函数先从函数说起,方法跟函数是有区别的,经常有人容易混淆,函数定义是def关键字定义(外面没class)deffun():a="hello"returna#......