
作者:微信公开课+
作品:微信公开课
地区:全国小程序
标签:教育,工具,微信公开课,资讯
描述:微信公开课是微信官方与小程序行业合作伙伴沟通交流的微信小程序社区,为线下微信小程序公开课的免费授课提供线上的相关服务,包括查阅小程序活动议程、参与小程序活动互动以及回顾小程序课程内容等。
声明:作者对小程序服务信息内容及运营行为等真实性/合法性及有效性承担全部责任
订阅微信公开课小程序
-
求JAVA入门小程序源代码
2019-03-12 17:02:19微信公开课小程序热门讨论「求JAVA入门小程序源代码」最新回复-mportjava.util.*;publicclassHuiWen{publicstaticvoidmain(String[]args){Scannerin=newScanner(System.in);System.out.println(pleaseinputaString:);Stringst=in.nextLine();Strings=st.toLowerCase();inti=0;intj=s.length()1;booleant=true;charfirst=s.charAt(i);charlast=s.charAt(j);for(;ij;){while(!(first=a&&first=z)){i++;first=s.charAt(i);}while(!(last=a&&last=z)){j;last=s.charAt(i);}if(i=j)break;if(first==last){i++;j;first=s.charAt(i);last=s.charAt(j);}else{t=false;break;}}if(t)System.out.println(st+是回文串);elseSystem.out.println(st+不是回文串);}}//判断是否为回文字串//什么实用的程序,说具体点!你要计算器的程序吗?//下面是计算器的程序,把分拿来吧!importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;publicclassCalculator{publicstaticvoidmain(String[]args){CalculatorFrameframe=newCalculatorFrame();frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.setVisible(true);}}classCalculatorFrameextendsJFrame{publicCalculatorFrame(){setTitle(Calculator);CalculatorPanelpanel=newCalculatorPanel();add(panel);pack();}}classCalculatorPanelextendsPanel{publicCalculatorPanel(){setLayout(newBorderLayout());result=0;lastCommand==;start=true;flag=true;display=newJButton(0);display.setEnabled(false);add(display,BorderLayout.NORTH);ActionListenerinsert=newInsertAction();ActionListenercommand=newCommandAction();panel=newJPanel();panel.setLayout(newGridLayout(4,5));addButton(7,insert);addButton(8,insert);addButton(9,insert);addButton(/,command);addButton(CE,command);addButton(4,insert);addButton(5,insert);addButton(6,insert);addButton(*,command);addButton(Backspace,command);addButton(1,insert);addButton(2,insert);addButton(3,insert);addButton(,command);addButton(sqrt,command);addButton(0,insert);addButton(.,insert);addButton(=,command);addButton(+,command);addButton(1/x,command);add(panel,BorderLayout.CENTER);}privatevoidaddButton(Stringlabel,ActionListenerlistener){JButtonbutton=newJButton(label);button.addActionListener(listener);panel.add(button);}privateclassInsertActionimplementsActionListener{publicvoidactionPerformed(ActionEventevent){Stringinput=event.getActionCommand();if(start&&flag){display.setText();start=false;}if(flag)display.setText(display.getText()+input);}}privateclassCommandActionimplementsActionListener{publicvoidactionPerformed(ActionEventevent){Stringcommand=event.getActionCommand();if(command.equals(CE)){display.setText(0);start=true;flag=true;command==;}elseif(start&&flag){if(command.equals()){display.setText(command);start=false;}elseif((command.equals(1/x)||command.equals(sqrt))&&flag)calculate(Double.parseDouble(display.getText()),command);elseif(flag)lastCommand=command;}else{if(command.equals(Backspace)&&flag){Strings=display.getText();char[]s1=s.toCharArray();if(s.length()=2){Strings2=newString(s1,0,s.length()1);display.setText(s2);}else{display.setText(0);start=true;}}elseif(flag){calculate(Double.parseDouble(display.getText()),command);lastCommand=command;start=true;}}}}publicvoidcalculate(doublex,Stringcommand){if(lastCommand.equals(+))result+=x;elseif(lastCommand.equals())result=x;elseif(lastCommand.equals(/)){if(x!=0)result/=x;else{display.setText(除数不能为0);start=false;flag=false;return;}}elseif(lastCommand.equals(*))result*=x;elseif(command.equals(1/x)){if(x!=0)result=1/x;else{display.setText(除数不能为0);start=false;flag=false;return;}}elseif(command.equals(sqrt)){if(x=0)result=Math.sqrt(x);else{display.setText(函数输入无效);start=false;flag=false;return;}}elseif(lastCommand.equals(=))result=x;display.setText(+result);}privateJButtondisplay;privateJPanelpanel;privatedoubleresult;privateStringlastCommand;privatebooleanstart;privatebooleanflag;}
publicclassHelloWorld{ publicstaticvoidmain(String[]args){ System.out.println(HelloWorld!) }} 更多有关「求JAVA入门小程序源代码」的疑问请扫码关注微信公开课+小程序! -
求JAVA小程序.
2019-03-12 17:02:19微信公开课小程序热门讨论「求JAVA小程序.」最新回复-1、编写一个Java程序读取Windows目录下的win.ini文件,并打印输出其内容。答:自己看看下面的链接应该是可以学会的。http://hi.baidu.com/jackie_feng/blog/item/66958cdd34fc62305882dd10.html2.用字符流读写文件,要求如下:a.将自己的简单个人简介写入aa.txt;b.从aa.txt中读取并打印。答:这个自己写吧,无非就是读流写流的过程。3.从命令行接收10个参数,从小到大打印出来,并打印出他们的和以及平均数。答:publicstaticvoidmain(String[]args){int[]list=newint[args.length];intsum=0;doubleavg=0;for(inti=0;ilist.length;i++){list[i]=Integer.parseInt(args[i]);sum+=list[i];}Arrays.sort(list);for(inti=0;ilist.length;i++){System.out.println(list[i]);}System.out.println(平均数:+avg);System.out.println(和:+sum)}4.定义一个MyString类,写以下四个方法:a、booleanisNumber(Strings):判断参数是否是数字,返回布尔值。b、booleanisLetter(Strings):判断参数是否是字母,返回布尔值。c、booleanisUpper(Strings):判断参数是否是大写字母,返回布尔值。d、booleanisLower(Strings):判断参数是否是小写字母,返回布尔值。答:只写方法代码了。booleanisNumber(Strings){returns.matches(\\d+);}booleanisLetter(Strings){returns.matches([azAZ]);}booleanisUpper(Strings){returns.equals(s.toUpperCase());}booleanisLower(Strings){returns.equals(s.toLowerCase());}自己调试下,可能有些地方不太对。5.定义一个MyMath类,写一个用于计算a的b次方的方法,a和b均为参数。答:只写方法代码了doublepow(doublea,doubleb){returnMath.pow(a,b);}6.写一个test类,写以下方法:a、用构造方法初始化两个参数。b、求两者的平均值。c、求两者的最大值。d、求两者的最不值。e、求两者的和差积商。答:publicclassTest{//命名规范,类名要大写privateinta;privateintb;publicTest(){this.a=10;this.b=8;}//平均数publicdoubleavg(){return(a+b)/2;}//最大值publicintmax(){returnMath.max(a,b);}//最小值publicintmin(){returnMath.min(a,b);}//求两者的和差积商。//这4个方法自己写吧}这些题目很像企业的手写代码笔试题目啊!使用这些API的功能可是基本功哦,不要投机取巧,还是自己再写一遍,把印象放入脑中,下次再遇到相同的问题后才能迎刃而解啊!O(∩_∩)O!
还小程序 问题真不少 去看看file类吧 更多有关「求JAVA小程序.」的疑问请扫码关注微信公开课+小程序! -
求java小程序源代码 在线等 急急急!!!
2019-03-12 17:02:19微信公开课小程序热门讨论「求java小程序源代码 在线等 急急急!!!」最新回复-下面是俄罗斯方块游戏源代码还没完,这代码太长了,我用我另一个号再粘上importjavax.swing.*;importjavax.swing.JOptionPane;importjavax.swing.border.Border;importjavax.swing.border.EtchedBorder;importjava.awt.*;importjava.awt.event.*;/***游戏主类,继承自JFrame类,负责游戏的全局控制。*内含*1,一个GameCanvas画布类的实例引用,*2,一个保存当前活动块(ErsBlock)实例的引用,*3,一个保存当前控制面板(ControlPanel)实例的引用;*/publicclassErsBlocksGameextendsJFrame{/***每填满一行计多少分*/publicfinalstaticintPER_LINE_SCORE=100;/***积多少分以后能升级*/publicfinalstaticintPER_LEVEL_SCORE=PER_LINE_SCORE*20;/***最大级数是10级*/publicfinalstaticintMAX_LEVEL=10;/***默认级数是5*/publicfinalstaticintDEFAULT_LEVEL=5;privateGameCanvascanvas;privateErsBlockblock;privatebooleanplaying=false;privateControlPanelctrlPanel;privateJMenuBarbar=newJMenuBar();privateJMenumGame=newJMenu(游戏设置),mControl=newJMenu(游戏控制),mWindowStyle=newJMenu(窗口风格);privateJMenuItemmiNewGame=newJMenuItem(新游戏),miSetBlockColor=newJMenuItem(设置颜色...),miSetBackColor=newJMenuItem(设置底色...),miTurnHarder=newJMenuItem(提升等级),miTurnEasier=newJMenuItem(调底等级),miExit=newJMenuItem(退出),miPlay=newJMenuItem(开始游戏),miPause=newJMenuItem(暂停),miResume=newJMenuItem(继续);privateJCheckBoxMenuItemmiAsWindows=newJCheckBoxMenuItem(风格1),miAsMotif=newJCheckBoxMenuItem(风格2),miAsMetal=newJCheckBoxMenuItem(风格3,true);/***主游戏类的构造函数*@paramtitleString,窗口标题*/publicErsBlocksGame(Stringtitle){super(title);//this.setTitle(lskdf);setSize(315,392);DimensionscrSize=Toolkit.getDefaultToolkit().getScreenSize();//获得屏幕的大小setLocation((scrSize.widthgetSize().width)/2,(scrSize.heightgetSize().height)/2);createMenu();Containercontainer=getContentPane();container.setLayout(newBorderLayout(6,0));canvas=newGameCanvas(20,12);ctrlPanel=newControlPanel(this);container.add(canvas,BorderLayout.CENTER);container.add(ctrlPanel,BorderLayout.EAST);addWindowListener(newWindowAdapter(){publicvoidwindowClosing(WindowEventwe){JOptionPaneabout=newJOptionPane();stopGame();System.exit(0);}});addComponentListener(newComponentAdapter(){publicvoidcomponentResized(ComponentEventce){canvas.fanning();}});show();canvas.fanning();}//游戏“复位”publicvoidreset(){ctrlPanel.reset();canvas.reset();}/***判断游戏是否还在进行*@returnboolean,true还在运行,false已经停止*/publicbooleanisPlaying(){returnplaying;}/***得到当前活动的块*@returnErsBlock,当前活动块的引用*/publicErsBlockgetCurBlock(){returnblock;}/***得到当前画布*@returnGameCanvas,当前画布的引用*/publicGameCanvasgetCanvas(){returncanvas;}/***开始游戏*/publicvoidplayGame(){play();ctrlPanel.setPlayButtonEnable(false);miPlay.setEnabled(false);ctrlPanel.requestFocus();}/***游戏暂停*/publicvoidpauseGame(){if(block!=null)block.pauseMove();ctrlPanel.setPauseButtonLabel(false);miPause.setEnabled(false);miResume.setEnabled(true);}/***让暂停中的游戏继续*/publicvoidresumeGame(){if(block!=null)block.resumeMove();ctrlPanel.setPauseButtonLabel(true);miPause.setEnabled(true);miResume.setEnabled(false);ctrlPanel.requestFocus();}/***用户停止游戏*/publicvoidstopGame(){playing=false;if(block!=null)block.stopMove();miPlay.setEnabled(true);miPause.setEnabled(true);miResume.setEnabled(false);ctrlPanel.setPlayButtonEnable(true);ctrlPanel.setPauseButtonLabel(true);}/***得到当前游戏者设置的游戏难度*@returnint,游戏难度1-MAX_LEVEL*/publicintgetLevel(){returnctrlPanel.getLevel();}/***让用户设置游戏难度*@paramlevelint,游戏难度1-MAX_LEVEL*/publicvoidsetLevel(intlevel){if(level11&&level0)ctrlPanel.setLevel(level);}/***得到游戏积分*@returnint,积分。*/publicintgetScore(){if(canvas!=null)returncanvas.getScore();return0;}/***得到自上次升级以来的游戏积分,升级以后,此积分清零*@returnint,积分。*/publicintgetScoreForLevelUpdate(){if(canvas!=null)returncanvas.getScoreForLevelUpdate();return0;}/***当分数累计到一定的数量时,升一次级*@returnboolean,tureupdatesuccessufl,falseupdatefail*/publicbooleanlevelUpdate(){intcurLevel=getLevel();if(curLevelMAX_LEVEL){setLevel(curLevel+1);canvas.resetScoreForLevelUpdate();returntrue;}returnfalse;}/***游戏开始*/privatevoidplay(){reset();playing=true;Threadthread=newThread(newGame());thread.start();}/***报告游戏结束了*/privatevoidreportGameOver(){JOptionPane.showMessageDialog(this,游戏结束!);}/***建立并设置窗口菜单*/privatevoidcreateMenu(){bar.add(mGame);bar.add(mControl);bar.add(mWindowStyle);mGame.add(miNewGame);mGame.addSeparator();mGame.add(miSetBlockColor);mGame.add(miSetBackColor);mGame.addSeparator();mGame.add(miTurnHarder);mGame.add(miTurnEasier);mGame.addSeparator();mGame.add(miExit);mControl.add(miPlay);mControl.add(miPause);mControl.add(miResume);mWindowStyle.add(miAsWindows);mWindowStyle.add(miAsMotif);mWindowStyle.add(miAsMetal);setJMenuBar(bar);miPause.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_P,KeyEvent.CTRL_MASK));miResume.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0));miNewGame.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventae){stopGame();reset();setLevel(DEFAULT_LEVEL);}});miSetBlockColor.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventae){ColornewFrontColor=JColorChooser.showDialog(ErsBlocksGame.this,设置积木颜色,canvas.getBlockColor());if(newFrontColor!=null)canvas.setBlockColor(newFrontColor);}});miSetBackColor.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventae){ColornewBackColor=JColorChooser.showDialog(ErsBlocksGame.this,设置底版颜色,canvas.getBackgroundColor());if(newBackColor!=null)canvas.setBackgroundColor(newBackColor);}});miTurnHarder.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventae){intcurLevel=getLevel();if(curLevelMAX_LEVEL)setLevel(curLevel+1);}});miTurnEasier.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventae){intcurLevel=getLevel();if(curLevel1)setLevel(curLevel1);}});miExit.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventae){System.exit(0);}});miPlay.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventae){playGame();}});miPause.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventae){pauseGame();}});miResume.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventae){resumeGame();}});miAsWindows.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventae){Stringplaf=com.sun.java.swing.plaf.windows.WindowsLookAndFeel;setWindowStyle(plaf);canvas.fanning();ctrlPanel.fanning();miAsWindows.setState(true);miAsMetal.setState(false);miAsMotif.setState(false);}});miAsMotif.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventae){Stringplaf=com.sun.java.swing.plaf.motif.MotifLookAndFeel;setWindowStyle(plaf);canvas.fanning();ctrlPanel.fanning();miAsWindows.setState(false);miAsMetal.setState(false);miAsMotif.setState(true);}});miAsMetal.addActionListener(newActionListener(){publicvoidactionPerformed(ActionEventae){Stringplaf=javax.swing.plaf.metal.MetalLookAndFeel;setWindowStyle(plaf);canvas.fanning();ctrlPanel.fanning();miAsWindows.setState(false);miAsMetal.setState(true);miAsMotif.setState(false);}});}/***根据字串设置窗口外观*@paramplafString,窗口外观的描述*/privatevoidsetWindowStyle(Stringplaf){try{UIManager.setLookAndFeel(plaf);SwingUtilities.updateComponentTreeUI(this);}catch(Exceptione){}}/***一轮游戏过程,实现了Runnable接口*一轮游戏是一个大循环,在这个循环中,每隔100毫秒,*检查游戏中的当前块是否已经到底了,如果没有,*就继续等待。如果到底了,就看有没有全填满的行,*如果有就删除它,并为游戏者加分,同时随机产生一个*新的当前块,让它自动下落。*当新产生一个块时,先检查画布最顶上的一行是否已经*被占了,如果是,可以判断GameOver了。*/privateclassGameimplementsRunnable{publicvoidrun(){//产生新方快intcol=(int)(Math.random()*(canvas.getCols()3)),style=ErsBlock.STYLES[(int)(Math.random()*7)][(int)(Math.random()*4)];while(playing){if(block!=null){//第一次循环时,block为空if(block.isAlive()){try{Thread.currentThread().sleep(100);}catch(InterruptedExceptionie){ie.printStackTrace();}continue;}}checkFullLine();//检查是否有全填满的行if(isGameOver()){//检查游戏是否应该结束了miPlay.setEnabled(true);miPause.setEnabled(true);miResume.setEnabled(false);ctrlPanel.setPlayButtonEnable(true);ctrlPanel.setPauseButtonLabel(true);reportGameOver();return;}block=newErsBlock(style,1,col,getLevel(),canvas);block.start();col=(int)(Math.random()*(canvas.getCols()3));style=ErsBlock.STYLES[(int)(Math.random()*7)][(int)(Math.random()*4)];ctrlPanel.setTipStyle(style);}}/***检查画布中是否有全填满的行,如果有就删除之*/publicvoidcheckFullLine(){for(inti=0;icanvas.getRows();i++){introw=1;booleanfullLineColorBox=true;for(intj=0;jcanvas.getCols();j++){if(!canvas.getBox(i,j).isColorBox()){fullLineColorBox=false;break;}}if(fullLineColorBox){row=i;canvas.removeLine(row);}}}/***根据最顶行是否被占,判断游戏是否已经结束了。*@returnboolean,true游戏结束了,false游戏未结束*/privatebooleanisGameOver(){for(inti=0;icanvas.getCols();i++){ErsBoxbox=canvas.getBox(0,i);if(box.isColorBox())returntrue;}returnfalse;}}
/* *12.24日,完成了蛇撞到自己的检测.修改方法是在蛇的初始化的时候,用双循环来置FALSE;*在重写代码的时候,我借鉴了别人的思路:将整个游戏的界面定义为一个布尔型的二维数组.*用一个LinkedList来储存蛇.当蛇移动的时候,在蛇的头部增加一个节点,然后删除最后一个节点.*因为只是做练习,所以没做游戏界面,比如菜单栏,计分栏什么的.另外还有一个问题,就是当两次点击回车时,蛇的移动速度会变快*/importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.util.*;publicclassGame{publicstaticvoidmain(Stringargs[]){ GameFrameframe=newGameFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setResizable(false); frame.show(); JOptionPane.showMessageDialog(null,上,下左,右控制蛇的方向n回车开始,S暂停);}}classGameFrameextendsJFrame{publicGameFrame(){ setSize(294,482); setTitle(贪吃蛇DEMO); this.setLocation(360,100); Containerc=getContentPane(); GamePanelpanel=newGamePanel(); c.add(panel,BorderLayout.CENTER);}}classGamePanelextendsJPanelimplementsKeyListener{staticintpanelWidth=294; staticintpanelHeight=450;intrectX=15;intrectY=15;Snakesnake;Noden;publicGamePanel(){ snake=newSnake(this,panelWidth/rectX,panelHeight/rectY); setBackground(Color.WHITE); setSize(panelWidth,panelHeight); setFocusable(true); addKeyListener(this);}publicvoidpaintComponent(Graphicsg){ super.paintComponent(g); Graphics2Dg2=(Graphics2D)g; LinkedListlist=snake.snakeList; Iteratorit=list.iterator(); g2.setColor(Color.black); while(it.hasNext()){ n=(Node)it.next(); drawNode(g2,n); } g2.setColor(Color.ORANGE); Nodef=snake.food; drawNode(g2,f); snake.drawMap(g2);//绘制地图}publicvoidkeyPressed(KeyEvente){ intkeycode=e.getKeyCode(); if(keycode==KeyEvent.VK_ENTER){ begin(); }elseif(keycode==KeyEvent.VK_UP){ snake.changeDirection(Snake.up); }elseif(keycode==KeyEvent.VK_DOWN){ snake.changeDirection(Snake.down); }elseif(keycode==KeyEvent.VK_LEFT){ snake.changeDirection(Snake.left); }elseif(keycode==KeyEvent.VK_RIGHT){ snake.changeDirection(Snake.right); }elseif(keycode==KeyEvent.VK_S){ Snake.run=false; }}publicvoidkeyReleased(KeyEvente){}publicvoidkeyTyped(KeyEvente){}publicvoiddrawNode(Graphics2Dg,Noden){ g.fillRect(n.x*rectX,n.y*rectY,rectX-2,rectY-2);}publicvoidbegin(){ Snake.run=true; SnakeThreadthread=newSnakeThread(snake); thread.start();}}classNode{intx;inty;publicNode(intx,inty){ this.x=x; this.y=y;}}classSnakeThreadextendsThread{Snakesnake;publicSnakeThread(Snakes){ snake=s;}publicvoidrun(){ Snake.run=true; while(Snake.run){ try{snake.move();sleep(200); }catch(InterruptedExceptione){ } } Snake.run=false;}}classSnake{GamePanelpanel;Nodefood;boolean[][]all;publicstaticbooleanrun;intmaxX;intmaxY;publicstaticintleft=1;publicstaticintup=2;publicstaticintright=3;publicstaticintdown=4;intdirection=4;LinkedListsnakeList=newLinkedList();publicSnake(GamePanelp,intmaxX,intmaxY){ panel=p; this.maxX=maxX; this.maxY=maxY; all=newboolean[maxX][maxY]; for(inti=0;imaxX;i++){ for(intj=0;jmaxY;j++){all[i][j]=false; } } intarrayLength=maxX20?10:maxX/2; for(inti=0;iarrayLength;i++){ intx=maxX/10+i; inty=maxY/10; snakeList.addFirst(newNode(x,y)); all[x][y]=true; } food=createFood(); all[food.x][food.y]=true;}//蛇移动的方法publicvoidmove(){ Noden=(Node)snakeList.getFirst(); intx=n.x; inty=n.y; if(direction==3){ x++; }elseif(direction==4){ y++; }elseif(direction==1){ x--; }elseif(direction==2){ y--; } //实现对蛇撞到自身的检测 if((0=x&&x=GamePanel.panelWidth/15-1)&&(0=y&&y=GamePanel.panelHeight/15-1)){ if(all[x][y]){if(x==food.x&&y==food.y){ snakeList.addFirst(food); food=createFood(); all[food.x][food.y]=true;}else{ JOptionPane.showMessageDialog(null,你撞到自己了); System.exit(0);} }else{snakeList.addFirst(newNode(x,y));all[x][y]=true;Nodel=(Node)snakeList.getLast();snakeList.removeLast();all[l.x][l.y]=false; } }else{ JOptionPane.showMessageDialog(null,越界了,游戏结束); System.exit(0); } panel.repaint();}publicNodecreateFood(){ intx=0; inty=0; do{ Randomr=newRandom(); x=r.nextInt(maxX-10); y=r.nextInt(maxY-10); }while(all[x][y]); returnnewNode(x,y);}//设置蛇不能回头publicvoidchangeDirection(intnewDirection){ if(direction%2!=newDirection%2){ direction=newDirection; }}publicvoiddrawMap(Graphics2Dg){ for(inti=0;imaxX;i++){ for(intj=0;jmaxY;j++){if(all[i][j]==true){ g.setColor(Color.red); g.fillRect(i,j,4,4);} } }}} 更多有关「求java小程序源代码 在线等 急急急!!!」的疑问请扫码关注微信公开课+小程序! -
求java编成的“学生成绩管理”的小程序
2019-03-12 17:02:19微信公开课小程序热门讨论「求java编成的“学生成绩管理”的小程序」最新回复-importjava.util.Arrays;importjava.util.Scanner;publicclassSearchRecord{staticString[]name={张三,李四,王五,宋六,杨七,罗八};staticString[]subject={java,c++,oracle,mysql,jsp};staticint[][]score={{84,75,69,87,54},{90,86,81,72,59},{64,92,84,86,85},{46,58,68,67,60},{97,92,96,93,91},{82,69,64,75,73}};publicstaticvoidmain(String[]args){System.out.println(请输入:);Scannersca=newScanner(System.in);Stringstr=sca.next();if(str.equals(AVGCOU)){Strings=sca.next();avgcou(s);}elseif(str.equals(AVGSTU)){Strings=sca.next();avgstu(s);}elseif(str.equals(SORT)){Strings=sca.next();if(s.equals(sum))sortSum();elsesortSubject(s);}elseif(str.equals(SUM)){Strings=sca.next();sumScore(s);}elseif(str.equals(GET)){Strings1=sca.next();Strings2=sca.next();getScore(s1,s2);}}publicstaticvoidavgcou(Strings){intindex=0;intsum=0;floatavg=0;for(inti=0;isubject.length;i++){if(subject[i].equals(s)){index=i;break;}}System.out.println(index);for(inti=0;iname.length;i++){sum+=score[i][index];}avg=sum/name.length;System.out.println(课程+s+的平均分是:+avg);}publicstaticvoidavgstu(Strings){intindex=0;intsum=0;floatavg=0;for(inti=0;iname.length;i++){if(name[i].equals(s)){index=i;break;}}for(inti=0;isubject.length;i++){sum+=score[index][i];}avg=sum/name.length;System.out.println(学生+s+的平均分是:+avg);}publicstaticvoidsortSum(){inttemp=0;Strings;int[]sum=newint[6];for(inti=0;iname.length;i++){for(intj=0;jsubject.length;j++){sum[i]+=score[i][j];}}for(inti=0;isum.length1;i++){for(intj=i+1;jsum.length;j++){if(sum[i]sum[j]){temp=sum[i];sum[i]=sum[j];sum[j]=temp;s=name[i];name[i]=name[j];name[j]=s;}}}System.out.println(按照总分进行升序排列的顺序是:);for(inti=0;isum.length;i++){System.out.print(name[i]+:);System.out.println(sum[i]);}}publicstaticvoidsortSubject(Strings){intindex=0;inttemp;Stringstr;for(inti=0;isubject.length;i++){if(subject[i].equals(s)){index=i;break;}}//System.out.println(index);for(inti=0;iname.length1;i++){for(intj=i+1;jname.length;j++){if(score[i][index]score[j][index]){temp=score[i][index];score[i][index]=score[j][index];score[j][index]=temp;str=name[i];name[i]=name[j];name[j]=str;}}}System.out.println(subject[index]+成绩按升序排列的顺序是:);for(inti=0;iname.length;i++){System.out.print(name[i]+:);System.out.println(score[i][index]);}}publicstaticvoidsumScore(Strings){intindex=0;intsum=0;for(inti=0;iname.length;i++){if(name[i].equals(s)){index=i;break;}}for(inti=0;isubject.length;i++){sum+=score[index][i];}System.out.print(name[index]+同学的总分是:);System.out.println(sum);}publicstaticvoidgetScore(Strings1,Strings2){intindex1=0;intindex2=0;for(inti=0;iname.length;i++){if(name[i].equals(s1)){index1=i;break;}}for(inti=0;isubject.length;i++){if(subject[i].equals(s2)){index2=i;break;}}System.out.print(name[index1]+同学+subject[index2]+的成绩是:);System.out.println(score[index1][index2]);}}自己写的
要界面的吗 更多有关「求java编成的“学生成绩管理”的小程序」的疑问请扫码关注微信公开课+小程序! -
求python小程序代码练练手
2019-03-12 17:02:19微信公开课小程序热门讨论「求python小程序代码练练手」最新回复-邮箱给我,私聊发给你
这题目怎么还没完结?既然这样1去把某宝网站的《情趣*用品*》(加上*是为了防止和谐你懂得)一关键词下所有的店铺名称、店主名称、各商品价格、产地等信息爬取下来初步用urllib然后研究怎么防止被封ip防止404然后研究研究线程增大速率研究研究压缩解压缩zip 提升速度5倍左右把抓到的数据存入数据库研究研究相关框架scrapy等这时候python的基本语法已经可以完成了当然不能就这么满足爬取什么时间段什么人买什么类产品的多用到分词统计出来然后怎么能做到利益最大化2回答百度知道下所有和python有关的问题3找到实习工作 更多有关「求python小程序代码练练手」的疑问请扫码关注微信公开课+小程序! -
求一java小程序,,像计算器,小游戏,或者什么的。
2019-03-12 17:02:19微信公开课小程序热门讨论「求一java小程序,,像计算器,小游戏,或者什么的。」最新回复-publicclassTest{doubleresult=0;booleanstart=true;StringlastCommand=+;//最终的符号Fontfont=newFont(null,Font.PLAIN,25);Fontfont2=newFont(null,Font.PLAIN,20);JFrameframe=newJFrame(简易计算器);JPanelpanel1=newJPanel();JPanelpanel2=newJPanel();JPanelpanel3=newJPanel();JPanelpanel4=newJPanel();JPanelpanel5=newJPanel();JTextFieldtext=newJTextField();JButtonb0=newJButton(0);JButtonb1=newJButton(1);JButtonb2=newJButton(2);JButtonb3=newJButton(3);JButtonb4=newJButton(4);JButtonb5=newJButton(5);JButtonb6=newJButton(6);JButtonb7=newJButton(7);JButtonb8=newJButton(8);JButtonb9=newJButton(9);JButtona1=newJButton(+);JButtona2=newJButton();JButtona3=newJButton(*);JButtona4=newJButton(/);JButtona5=newJButton(=);JButtona6=newJButton(.);JButtona7=newJButton(清零);JButtona8=newJButton(取消);JButtona9=newJButton(sqrt);JButtona10=newJButton(+/);publicvoidset(){frame.setSize(400,350);frame.setLayout(newGridLayout(5,1,2,2));panel1.setBackground(Color.black);panel2.setBackground(Color.red);panel3.setBackground(Color.blue);panel4.setBackground(Color.green);panel5.setBackground(Color.yellow);panel1.setLayout(newBorderLayout());panel1.add(text,Center);panel2.setLayout(newGridLayout(1,5,1,1));panel3.setLayout(newGridLayout(1,5,1,1));panel4.setLayout(newGridLayout(1,5,1,1));panel5.setLayout(newGridLayout(1,5,1,1));text.setHorizontalAlignment(JTextField.RIGHT);b0.setFont(font);b1.setFont(font);b2.setFont(font);b3.setFont(font);b4.setFont(font);b5.setFont(font);b6.setFont(font);b7.setFont(font);b8.setFont(font);b9.setFont(font);a1.setFont(font);a2.setFont(font);a3.setFont(font);a4.setFont(font);a5.setFont(font);a6.setFont(font);a7.setFont(font2);a8.setFont(font2);a9.setFont(font);a10.setFont(font);frame.setVisible(true);}publicvoidaddComponent(){panel2.add(b7);panel2.add(b8);panel2.add(b9);panel2.add(a4);panel2.add(a7);panel3.add(b4);panel3.add(b5);panel3.add(b6);panel3.add(a3);panel3.add(a8);panel4.add(b1);panel4.add(b2);panel4.add(b3);panel4.add(a2);panel4.add(a9);panel5.add(b0);panel5.add(a10);panel5.add(a6);panel5.add(a1);panel5.add(a5);frame.add(panel1);frame.add(panel2);frame.add(panel3);frame.add(panel4);frame.add(panel5);}publicvoidaddListener(){b0.addActionListener(newInsertAction());b1.addActionListener(newInsertAction());b2.addActionListener(newInsertAction());b3.addActionListener(newInsertAction());b4.addActionListener(newInsertAction());b5.addActionListener(newInsertAction());b6.addActionListener(newInsertAction());b7.addActionListener(newInsertAction());b8.addActionListener(newInsertAction());b9.addActionListener(newInsertAction());a1.addActionListener(newCommandAction());a2.addActionListener(newCommandAction());a3.addActionListener(newCommandAction());a4.addActionListener(newCommandAction());a5.addActionListener(newCommandAction());a6.addActionListener(newInsertAction());a7.addActionListener(newInsertAction());a8.addActionListener(newInsertAction());a9.addActionListener(newCommandAction());a10.addActionListener(newInsertAction());}publicvoidgo(){this.set();this.addComponent();this.addListener();}classInsertActionimplementsActionListener{publicvoidactionPerformed(ActionEventevent1){Stringinput=event1.getActionCommand();if(start){text.setText();start=false;if(input.equals(+/))text.setText(text.getText()+);}if(!input.equals(+/)){if(input.equals(取消)){Stringstr=text.getText();if(str.length()0)text.setText(str.substring(0,str.length()1));}elseif(input.equals(清零)){text.setText(0);lastCommand=+;start=true;result=0;}elsetext.setText(text.getText()+input);}}}classCommandActionimplementsActionListener{publicvoidactionPerformed(ActionEventevent2){Stringcommand=event2.getActionCommand();if(start){lastCommand=command;}else{//Doubledata=newDouble(text.getText());calculator(Double.parseDouble(text.getText()));lastCommand=command;start=true;}}}publicvoidcalculator(doublex){if(lastCommand.equals(+))result+=x;elseif(lastCommand.equals())result=x;elseif(lastCommand.equals(*))result*=x;elseif(lastCommand.equals(/))result/=x;elseif(lastCommand.equals(=))result=x;elseif(lastCommand.equals(sqrt))result=Math.sqrt(x);text.setText(+result);}publicstaticvoidmain(String[]args){Testa=newTest();a.go();}}
http://wenku.baidu.com/view/1e8851de6bec0975f565e213.html五子棋 更多有关「求一java小程序,,像计算器,小游戏,或者什么的。」的疑问请扫码关注微信公开课+小程序! -
求一WEB 小程序,JAVASCRIPT写 在网页上第一行显示今天是星期几 第二行显示当前时间
2019-03-12 17:02:19微信公开课小程序热门讨论「求一WEB 小程序,JAVASCRIPT写 在网页上第一行显示今天是星期几 第二行显示当前时间」最新回复-随手写的,不是很完美,但,复合要求,把这段贴到记事本中,将后缀名改成.html结尾即可运行。比如aaa.txtaaa.html!DOCTYPEHTMLPUBLIC//W3C//DTDHTML4.01Transitional//ENhttp://www.w3.org/TR/html4/loose.dtdhtmlheadmetahttpequiv=ContentTypecontent=text/html;charset=gb2312title日期/titlescriptlanguage=javascriptfunctionshow(){varx=newDate();vary=x.getYear();//年varm=x.getMonth();//月vard=x.getDay();//星期vards=x.getDate();//日varh=x.getHours();//小时varm1=x.getMinutes();//分vars=x.getSeconds();//秒varday;if(x.getDay()==0)day=星期日;if(x.getDay()==1)day=星期一;if(x.getDay()==2)day=星期二;if(x.getDay()==3)day=星期三;if(x.getDay()==4)day=星期四;if(x.getDay()==5)day=星期五;if(x.getDay()==6)day=星期六;vartimer=+((h12)?h12:h);timer+=((m110)?:0::)+m1;timer+=((s10)?:0::)+s;timer+=+((h=12)?pm:am);document.s1.b1.value=y;document.s1.b2.value=m+1;document.s1.b3.value=ds;document.s1.b4.value=timer;document.s1.b5.value=day;setTimeout(show(),1000);}/script/headbodyonload=show()formname=s1onSubmit=0今天inputtype=textname=b5size=5brBR当前时间:inputtype=textname=b1size=5年inputtype=textname=b2size=5月inputtype=textname=b3size=5日inputtype=textname=b4size=15/form/body/html希望对楼主有用。
!DOCTYPEhtmlPUBLIC-//W3C//DTDXHTML1.0Transitional//ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtdhtmlxmlns=http://www.w3.org/1999/xhtmlheadmetahttp-equiv=Content-Typecontent=text/html;charset=utf-8/title无标题文档/title/headbodyscriptvard=newDate();varday=d.getDay();switch(day){case0:document.write(星期日);break;case1:document.write(星期一);break;case2:document.write(星期二);break;case3:document.write(星期三);break;case4:document.write(星期四);break;case5:document.write(星期五);break;case6:document.write(星期六);break;}document.write(br+d.getHours()+:+d.getMinutes()+:+d.getSeconds());/script/body/html 更多有关「求一WEB 小程序,JAVASCRIPT写 在网页上第一行显示今天是星期几 第二行显示当前时间」的疑问请扫码关注微信公开课+小程序! -
求一个 表白的小程序c代码
2019-03-12 17:02:19微信公开课小程序热门讨论「求一个 表白的小程序c代码」最新回复-你还真不如用Flash做,图文并茂。
printf(Fuckme);追问sha b//?追答少年,默认的c没有图形库函数,你再怎么写也是枯燥的控制面板,要表白,怎么也写个有图的对吧。比如说用Matlab的plot画一个爱心什么的之类的。如果你硬要用c的话,我建议你可以去参考一下,国际乱码大赛的代码,就是要你在代码格式上做文章。如果都不想看的话,你就写fuckme吧,简单直接,基友什么的最喜欢了已赞过已踩过评论收起月霜白露2014-03-15月霜白露采纳数:34获赞数:32LV5擅长:C/C++散文向TA提问私信TA展开全部#includestdio.hintmain(){printf(******** );printf(**** );printf(***** );printf(** );printf(** );printf(** );printf(** );printf(** );printf(** );printf(** );printf(** );printf(** );return0;} 更多有关「求一个 表白的小程序c代码」的疑问请扫码关注微信公开课+小程序!