微信公开课小程序热门讨论「急求大神发几个java 300行代码的小程序 简单点的」最新回复-/***文件名:Operation.java201412下午3:06:37*@authorAdministrator*/packagecc.icoc.javaxu.action;importjava.util.ArrayList;importjava.util.Scanner;importcc.icoc.javaxu.datas.StudentInfo;/***@author许仕永*创建时间:2014201412下午3:06:37*/publicclassOperation{intstuNo,stuAge;StringstuName,stuClass,stuSex;ArrayListStudentInfolist;/**程序入口*@paramargs*/publicstaticvoidmain(String[]args){//TODOAutogeneratedmethodstubnewOperation().operation();}privateintinputInt(){Scannerscanner=newScanner(System.in);returnscanner.nextInt();}privateStringinputStr(){Scannerscanner=newScanner(System.in);returnscanner.nextLine();}privatevoidoperation(){//TODOAutogeneratedmethodstubif(list==null){list=newArrayListStudentInfo();}while(true){System.out.println(\t\t\t学生信息管理系统\n);System.out.println(1.信息查阅);System.out.println(2.信息查询);System.out.println(3.信息录入);System.out.println(4.退出系统);intwhat=inputInt();if(what==1){getInfo();}elseif(what==2){allSerach();}elseif(what==3){inputInfo();}elseif(what==4){System.out.println(已经退出系统);System.exit(0);}}}/***获取全部学生的信息列表*/privatevoidgetInfo(){if(!list.isEmpty()){for(inti=0;ilist.size();i++){System.out.println(list.get(i));}}}/***执行查找*/privatevoidallSerach(){System.out.println(1.输入学号进行查询);System.out.println(2.输入姓名进行查询);intwhat=inputInt();if(what==1){System.out.println(请输入学号:);search(inputInt());}else{System.out.println(请输入姓名:);search(inputStr());}}/***按学生姓名查询学生信息*@paramname学生姓名*/privateStudentInfosearch(Stringname){for(inti=0;ilist.size();i++){if(list.get(i).getStuName().equals(name)){System.out.println(list.get(i));returnlist.get(i);}}System.out.println(未查询到该名字的学生);returnnull;}/***按学号查询学生信息*@paramid学号*/privateStudentInfosearch(intid){for(inti=0;ilist.size();i++){if(list.get(i).getStuNo()==id){System.out.println(list.get(i));returnlist.get(i);}}System.out.println(未查询到该学号的学生);returnnull;}/***录入学生信息*/privatevoidinputInfo(){try{System.out.print(请输入学生学号:\n);stuNo=inputInt();System.out.print(请输入学生姓名:\n);stuName=inputStr();System.out.print(请输入学生性别:\n);stuSex=inputStr();System.out.print(请输入学生年龄:\n);stuAge=inputInt();System.out.print(请输入学生班级:\n);stuClass=inputStr();list.add(newStudentInfo(stuNo,stuAge,stuName,stuSex,stuClass));}catch(Exceptione){//TODO:handleexceptionSystem.out.println(不允许为空,请重新输入);}}}packagecc.icoc.javaxu.action;importjava.util.ArrayList;importjava.util.List;importjava.util.Scanner;publicclassStu{intcountStu=0;intsum=0;intavg=0;ListStuBeanlist=newArrayListStu.StuBean();publicstaticvoidmain(String[]args){newStu().go();}privatevoidgo(){A:while(true){//构造实体Bean来存储学生成绩StuBeanbean=newStuBean();System.out.println(请输入成绩:);System.out.println(语文:);bean.setYuwen(scanner());System.out.println(数学:);bean.setMath(scanner());//获取英语成绩System.out.println(英语:);bean.setEnglish(scanner());//存入容器list.add(bean);for(inti=0;ilist.size();i++){sum+=list.get(i).english+list.get(i).math+list.get(i).yuwen;}avg=sum/(3*list.size());System.out.println(当前有+list.size()+条学生记录,所有学生总分=+sum+平均分为+avg);//输入y继续录入学生信息,输入x退出System.out.println(\n已成功录入一个学生的数据,是否继续/退出(y/x));if(x.equals(scannerString()))breakA;}}/**输入*/privateintscanner(){Scannerscanner=newScanner(System.in);returnscanner.nextInt();}/**输入*/privateStringscannerString(){Scannerscanner=newScanner(System.in);returnscanner.nextLine();}classStuBean{intmath;intyuwen;intenglish;publicintgetMath(){returnmath;}publicvoidsetMath(intmath){this.math=math;}publicintgetYuwen(){returnyuwen;}publicvoidsetYuwen(intyuwen){this.yuwen=yuwen;}publicintgetEnglish(){returnenglish;}publicvoidsetEnglish(intenglish){this.english=english;}}}/***文件名:StudentInfo.java201412下午3:07:29*@authorAdministrator*/packagecc.icoc.javaxu.datas;/***@author许仕永*创建时间:2014201412下午3:07:29*/publicclassStudentInfo{intstuNo,stuAge;StringstuName,stuSex,stuClass;publicStudentInfo(intstuNo,intstuAge,StringstuName,StringstuSex,StringstuClass){super();this.stuNo=stuNo;this.stuAge=stuAge;this.stuName=stuName;this.stuSex=stuSex;this.stuClass=stuClass;}publicintgetStuNo(){returnstuNo;}publicvoidsetStuNo(intstuNo){this.stuNo=stuNo;}publicintgetStuAge(){returnstuAge;}publicvoidsetStuAge(intstuAge){this.stuAge=stuAge;}publicStringgetStuName(){returnstuName;}publicvoidsetStuName(StringstuName){this.stuName=stuName;}publicStringgetStuSex(){returnstuSex;}publicvoidsetStuSex(StringstuSex){this.stuSex=stuSex;}publicStringgetStuClass(){returnstuClass;}publicvoidsetStuClass(StringstuClass){this.stuClass=stuClass;}@OverridepublicStringtoString(){//TODOAutogeneratedmethodstubStrings=学号:+getStuNo()+\t姓名:+getStuName()+\t性别:+getStuSex()+\t年龄:+getStuAge()+\t班级:+getStuClass();returns;}}
《Java就业培训教程》P34源码程序清单:Promote.javaclassPromote{publicstaticvoidmain(Stringargs[]){ byteb=50; charc=a; shorts=1024; inti=50000; floatf=5.67f; doubled=.1234; doubleresult=(f*b)+(i/c)-(d*s); System.out.println((f*b)+++(i/c)+-+(d*s)); System.out.println(result=+result);}}《Java就业培训教程》P35源码程序清单:TestScope.javapublicclassTestScope{publicstaticvoidmain(String[]args){ intx=12; { intq=96; //x和q都可用 System.out.println(xis+x);System.out.println(qis+q); }q=x; /*错误的行,只有x可用,q超出了作用域范围*/System.out.println(xis+x); }}《Java就业培训教程》P37源码程序清单:TestVar.javapublicclassTestVar{publicstaticvoidmain(String[]args){intx;//应改为intx=0;x=x+1; //这个x由于没有初始化,编译会报错。System.out.println(xis+x);}}程序清单:Func1.javapublicclassFunc1{publicstaticvoidmain(String[]args){/*下面是打印出第一个矩形的程序代码*/ for(inti=0;i3;i++) { for(intj=0;j5;j++) {System.out.print(*); } System.out.println();//换行 } System.out.println(); //下面是打印出第二个矩形的程序代码 for(inti=0;i2;i++) { for(intj=0;j4;j++) {System.out.print(*); } System.out.println(); } System.out.println(); //下面是打印出第三个矩形的程序代码 for(inti=0;i6;i++) { for(intj=0;j10;j++) {System.out.print(*); } System.out.println(); } System.out.println();}}《Java就业培训教程》P39源码程序清单:Func2.javapublicclassFunc2{publicstaticvoiddrawRectangle(intx,inty){ for(inti=0;ix;i++) { for(intj=0;jy;j++) {System.out.print(*); } System.out.println();//换行 } System.out.println();}publicstaticvoidmain(String[]args){ drawRectangle(3,5); drawRectangle(2,4); drawRectangle(6,10);}}《Java就业培训教程》P40源码程序清单:Func3.javapublicclassFunc3{publicstaticintgetArea(intx,inty){ returnx*y;}publicstaticvoidmain(String[]args){ intarea=getArea(3,5); System.out.println(firstAcreageis+area); System.out.println(secondAcreageis+getArea(2,4)); getArea(6,10);}}《Java就业培训教程》P41源码程序清单:Func4.javapublicclassFunc4{ publicstaticintgetArea(intx,inty) { if(x=0||y=0) {return-1; } returnx*y; } publicstaticvoidmain(String[]args) { intarea=getArea(3,5); System.out.println(firstAcreageis+area); System.out.println(secondAcreageis+getArea(2,4)); getArea(6,10); }}《Java就业培训教程》P43源码程序清单:Test.javapublicclassTest{publicstaticvoidmain(String[]args){ intisum; doublefsum; isum=add(3,5); isum=add(3,5,6); fsum=add(3.2,6.5);}publicstaticintadd(intx,inty){ reutrnx+y;}publicstaticintadd(intx,inty,intz){ returnx+y+z;}publicstaticdoubleadd(doublex,doubley){ returnx+y;}}《Java就业培训教程》P47源码publicclassTestAnd{ publicstaticvoidmain(String[]args) {intx=0;inty=0;if(x!=0&&y==y/x)System.out.println(y=+y); }}《Java就业培训教程》P48源码程序清单:ShiftTest.javapublicclassShiftTest{publicstaticvoidmain(String[]args){ intx=0x80000000; inty=0x80000000; x=x1; y=y1; System.out.println(0x800000001=+Integer.toHexString(x));System.out.println(0x800000001=+Integer.toHexString(y));}}《Java就业培训教程》P61源码程序清单:TestDo.javapublicclassTestDo{publicstaticvoidmain(String[]args){ intx=3; while(x==0) { System.out.println(ok1); x++; } inty=3; do { System.out.println(ok2); y++; } while(y==0);}}《Java就业培训教程》P64源码程序清单:PrintOddNum.javapublicclassPrintOddNum{publicstaticvoidmain(String[]args){for(inti=0;i10;i++){ if(i%2==0) continue; System.out.println(i);}}} 《Java就业培训教程》P67源码程序清单:TestArray.javapublicclassTestArray{publicstaticvoidmain(String[]args){intx[]; x=newint[100]; for(inti=0;i100;i++) { System.out.println(x+i+is+x[i]); }}}《Java就业培训教程》P73源码程序清单:TestArrayCopy.javapublicclassTestArrayCopy{publicstaticvoidmain(String[]args){intia[]=newint[]{1,2,3,4,5};intib[]=newint[]{9,8,7,6,5,4,3};System.arraycopy(ia,0,ib,0,3); //复制源数组中从下标0开始的3个元素到目的数组,从下标0的位置开始存储。for(inti=0;iia.length;i++)System.out.print(ia[i]); System.out.println();for(intj=0;jib.length;j++)System.out.print(ib[j]); System.out.println();}} 更多有关「急求大神发几个java 300行代码的小程序 简单点的」的疑问请扫码关注微信公开课+小程序!了解更多
方法1:微信扫描微信公开课小程序码即可订阅热议话题「急求大神发几个java 300行代码的小程序 简单点的」
方法2:微信搜索微信公开课小程序名称进入,即可订阅热议话题「急求大神发几个java 300行代码的小程序 简单点的」
方法3:微信网页访问即速商店,长按识别微信公开课小程序码即可订阅热议话题「急求大神发几个java 300行代码的小程序 简单点的」
微信公开课小程序热议话题「急求大神发几个java 300行代码的小程序 简单点的」由微信公开课原创摘录于微信小程序商店shop.jisuapp.cn,转载请注明出处。
微信公开课热议话题「急求大神发几个java 300行代码的小程序 简单点的」由微信公开课开发者向微信用户提供,并对本服务内容、数据资料及其运营行为等真实性、合法性及有效性承担全部责任。