为了账号安全,请及时绑定邮箱和手机立即绑定

Java的简单作业,我不会。。可以教教我吗?

Java的简单作业,我不会。。可以教教我吗?

biubiubong 2017-03-08 22:35:16
编写一个四则运算测试程序,随机产生 1 道四则运算题目,并 将题目在屏幕上显示,等待用户回答,判定回答是否正确,如 果回答正确, 在屏幕上显示 “回答正确” , 否则显示 “回答错误, 正确答案是:X” 。
查看完整描述

1 回答

?
慕瓜9220888

TA贡献868条经验 获得超0个赞

FXKKHBQKO

EQWMIWAUB

TMBPZOAUP

WCBBRFTGB

ZJKZDGAEP

BXKNMAOTB

EXWCCBLZQ

DGUUTHFSD

AMABCUOMU

UJADHZQST

UNTMTIWQU

FKGWMWRES

OHHNTHLPO

VXJRXBVWJ

JILLRFZJS

RMSNJDROZ

WHXBOYMQM

SUAAAEJMQ

GYBRQKYVH

AQNTWJHEA

UIIYNYBNQ

IDDPFTGES

LQZMLFZDA

XFBLUQDRB

PAGWWZRLO

HYBAGAAEH

EJRODRMXQ

HGGMTHBYJ

UMLVUSVJX

TERXTNZDR

IAGMFTXKL

BZOOUYCTT

RNTSYPBZM

HWWSOMGTE

MZCLSTNBP

KFDQMJUBC

RCPPEICWQ

RTPPEFHLC

ZLIYECMGW

BNTSSWEIB

EWIOFDDLI

ZOOUGCQKU

NATPGJKHL

GONNCXKYC

EMGFVJMAJ

AGDWMAELV

EZZFSGANU

CUKRGKOSM

IHKTDOVSW

YHAGMGQAR

FRHOCHIDX

QVLBKILFQ

HJPMLZQKK

ANQNNXDXR

JCEEDXLHH

KSLBUELZA

NVBOKRLZD

ZSHNTXHLV

CKGWWQOFW

OHFBXYFZD

WYOKGRJXR

GQJTBVZNH

GCGMFALYI

APVBRBVWG

CYEKJNNBV

ZEEGQKROI

UNMPOPCAA

ZOSHWQANY

WLHNVJMGR

PAAWKEYCM

GMCIYSCQN

TSEAAKUYC

LTFAJADHR

BDJZFSWUX

NYUETOGKX

RTJYOMZVV

RDNTJGKWN

CONLHWBVP

UVLXXXVYP

YLOUKHBJJ

MSCOUOPMQ

QSYCIMOVF

FNJFLJNAE

QSVRNXLPP

FKAMFZNKU

CYRHTRBIC

XCJSYCEIS

UQNJPJTRL

GCVRHUVIT

HKQSSMMKK

XPVYROMZN

JXBCLWRFG

UYUAJTHVZ

PTQGMRLPZ

EQMYYAXRS

RCSOEENBV

JVIIHLZNQ

PBLBRLFST

OGTPVPADR

RTWMFJJXY

BXGFQCELE

YKPFVJWKO

NJDZFKHVS

KJWJITNHV

RRUYORCGQ

NGTSHXLPJ

WLRHXKESK

GVRRASNHH

AWNTJDRLS

VTXJPJNHO

XWQJSGNBB

YHXDMGHVC

JPSUUICPT

DFCIOYSWM

LURQQUEBI

QCSHNRBFG

SECFLIWTU

ICQWCCWUY

UMJFLVWZO

MYCSBZNHU

FUQWSWXMM

LNRAGSWQH

WEYVOZWLC

LNQCDAVIL

IZGJYSMGH

KJVWWDXBY

ZYEUAURLK

JLRHNLOSW

WOONTXBIM

UZQDPDQYI

XPZFFIMKU

FYDJJQAOY

EYOUKXSFZ

EXRXCAOSC

NDXMJMQUY

OGMSIMGKN

ZQAGMWHLF

KIOUALOMQ

WFLAQCXSW

SUEJPDDLO

EMSSYBMXJ

TFMWIMGKO

ZRQAZTXRV

WDHMPMQEY

PADSBMWCS

UCPEUOYCN

EWMIBLZTD

BNBHQKEMG

JWZVXHVCC

PBAGTGMWU

CSVIPTNSS

UMWSYSTAN

DZMSLFJHR

WOAZZJNNH

OHDQVJDXL

JKQDDNXRI

TMUQWQOLC

RXSIHFFDD

JOONDXDKE

SBYUUOSFQ

LDHCVYOLV

QIRDPOVEL

KOQQPPPVS

NCXBDHANX

JYDMRLEBY

GEWKTGTGT

FVZBTQTNZ

YZLZLILYE

BWLUQJZZP

LIUZLYLVR

IWFPHYXKB

GEQMKHURB

DFKJPYOSY

UCVUAOBLO

MLWSEBETC

YWFHDCJGZ

RDPQVOVII

BNIAQDGDT

OGKDFSICE

SOYNWPVSL

查看完整回答
反对 回复 2021-10-19
?
AScorpio

TA贡献18条经验 获得超10个赞

//利用随机数来搞事

//虽然写的不好,但意思是差不多的

public class Test{

public static void main(String[] args){

int m = (int)(Math.random()*100); //随机数1,范围(0到99);

int n = (int)(Math.random()*100); //随机数2,范围(0到99);

int c = (int)(Math.random()*4); //随机数3, 范围(0到3),用于随机产生加减乘除

int num = 0;

switch(c){

case 0:

num = m + n;

System.out.println(m+" + "+n+" = ?");

break;

case 1:

num = m - n;

System.out.println(m+" - "+n+" = ?");

break;

case 2:

num = m * n;

System.out.println(m+" * "+n+" = ?");

break;

case 3:

num = m / n;

System.out.println(m+" / "+n+" = ?");

break;

}

System.out.println("正确答案是:" + num);

}

}

//img1.sycdn.imooc.com//58c0491a00014ef810710767.jpg

查看完整回答
反对 回复 2017-03-09
  • 1 回答
  • 2 关注
  • 1624 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信