µ¶Ê¯Í·²¼ÓÎÏ· java°æ
import java.util.Scanner;
public class Game{
void welcome(){
println("»¶ÓÀ´µ½¼ôµ¶Ê¯Í·²¼ÓÎÏ·");
}
Choice getUserChoice(){
println("ÇëÑ¡Ôñ\t[1]¼ôµ¶\t[2]ʯͷ\t[3]²¼");
Scanner sc= new Scanner(System.in);
int userChoice=Integer.parseInt(sc.nextLine());
while(userChoice>3||userChoice<1){
println("ÄúÊäÈëµÄ²»ºÏ·¨£¬ÇëÖØÐÂÊäÈë");
userChoice=Integer.parseInt(sc.nextLine());
}
return new Choice(userChoice);
}
Choice getComputerChoice(){
return new Choice((int)(3*Math.random())+1);
}
void showResult(Choice userChoice,Choice computerChoice){
int re=userChoice.compareTo(computerChoice);
if(re==0){
println("ƽÁË!ÄúºÃ,ÄúÊäÈëµÄÊÇ:"+userChoice.getText());
}else if(re==1){
println("¹§Ï²Äú»ñʤÁË£¡ÄúÊäÈëµÄÊÇ:"+userChoice.getText()+"\tµçÄÔÊäÈëµÄÊÇ:"+computerChoice.getText());
}
else {
println("±§Ç¸ÄúÊäÁË£¡ÄúÊäÈëµÄÊÇ:"+userChoice.getText()+"\tµçÄÔÊäÈëµÄÊÇ:"+computerChoice.getText());
}
}
void println(String s){
System.out.println(s);
}
void start(){
welcome();
Choice userChoice=getUserChoice();
Choice computerChoice=getComputerChoice();
showResult(userChoice,computerChoice);
}
public static void main(String[] args){
new Game().start();
}
}
class Choice{
String s[]={"¼ôµ¶","ʯͷ","²¼"};
int value;
Choice(int a){
value=a;
}
String getText(){
return s[value-1];
}
// 0Ϊ ƽ 1Ϊ Ó® -1Ϊ Êä
int compareTo(Choice c){
if(value==c.value){
&nb
Ïà¹ØÎĵµ£º
1.¼¯ºÏµÄÌØµã£º
¶¼Î»ÓÚ java.util°üÖУ¬²»ÄÜ´æ·Å»ù±¾ÀàÐ͵ÄÊý¾Ý£¬¶øÖ»ÄÜ´æ·Å¶ÔÏóµÄÒýÓ㬲Ù×÷µÄÊýÄ¿¿ÉÒÔ²»¹Ì¶¨£¨ÀàËÆÓÚ¶¯Ì¬Êý×飩¡£
2.·ÖÀࣺ
ÓÐÈý¸öÀࣺ
a.Set(¼¯)£º¶ÔÏó²»°´Ìض¨·½Ê½ÅÅÐò£¬Ã»ÓÐÖØ¸´ÔªËØ¡£Õâ¸öÓëÊýѧÖеļ¯ºÏ¸ÅÄî×îÏàËÆ¡£
b.List(Áбí)£º°´ÕÕË÷ÒýλÖÃÅÅÐò£¬¿ÉÒÔÓÐÖØ¸´ÔªËØ£¬ÔÊÐí°´ÕÕ¶ÔÏóÔÚ¼¯ºÏÖеÄË ......
/**
* ´´½¨ËõÂÔͼƬ
*
* @param orgpath
* @param filename
* @return
* @description: ÃèÊö
*/
//´Ë·½·¨¶ÔÓÚsshÏîÄ¿²¢ÇÒÕë¶Ô ÉÏ´«¹¦ÄÜʱ£¬·Ç³£ÓÐÓÃ
public static Boolean createAbbreviateImg(String orgpath, String filename) {
Boolea ......
±¾È˾ãËÄÄêÑз¢¾Ñ飨javaµÄ£©
˸øÎÒÍÆ¼ö·ÝǶÈëʽcְ룬cÓïÑÔһֱûÂäÏ£¬Ñ§µÄ»¹ÐС£¡£¡£¹¤×Ê¿ªÎÒ2k¾ÍÐУ¡
ֻΪ³É¹¦´òÈëǶÈëʽÊг¡¡£¡£¡£¸ø¸ö»ú»á°É¡£¡£
ÎÒÕæµÄÊÇÌ«ÏëºÍÄãÃÇ×öͬÐÐÀ²£¡
ÓÐÒâÏòµÄ¿ÉÒÔÁªÏµÎÒ¡£¡£ÎÒ²»Ìô´ýÓö£¬¶Ô¹¤×÷¾ÍÒ»¸öÒªÇó£¬Ç¶Èëʽ¿ª·¢¡£¡£¡£ÎÒÓе쬾ÍÊÇ4ÄêµÄjavaÑз¢¾ÑéºÍc»ù´¡¡£¡£¡£ÌáÇ ......
½ñÌìºÍ´ó¼ÒÒ»ÆðѧϰJavaµÄÉè¼ÆÄ£Ê½¡£±¾È˵Äˮƽ²»ÊǺܸߣ¬ÕâϵÁÐÎÄÕÂÖ»ÊÇ×Ô¼ºÑ§Ï°µÄ¹ý³Ì£¬²¢Ï£ÍûÄÜͬ´ó¼Ò·ÖÏí¾Ñé¡£
ÏÈ˵ÏÂÎÒ¶Ô¹¤³§Ä£Ê½µÄÀí½â£ºµ±ÎÒÃÇÐèҪij¸ö¶ÔÏóʱ£¬×îÖ±½ÓµÄ°ì·¨ÊÇ¿´µ½Õâ¸ö¶ÔÏó¾ÍÄùýÀ´¡£µ«Êǵ±¶ÔÏó·Ç³£¶àµÄʱºò£¬ÕÒÆðÀ´¾ÍºÜ²»·½±ã¡£Õâʱ¾ÍÐèÒªÒ»¸öÖнéÀ´°ïÖúÎÒÃÇÈ¡µÃÏëÒªµÄ¶«Î÷£¬Õâ¸öÖнé¾ÍÊǹ¤³§£¨fa ......
·½·¨µÄÖØÔØ
£ºÍ¬Ò»¸öÀàÀïÃæ·½·¨µÄÃû×ÖÏàͬ£¬·½·¨µÄ²ÎÊýÏÖ÷ÒªÊDzÎÊýÀàÐÍ£¬²ÎÊý¸öÊý£©
²»Í¬
,
·µ»ØÀàÐÍ¿ÉÄܲ»Í¬¡£
ÖØÔØ·½·¨¿ÉÒÔ¾ßÓв»Í¬µÄ·µ»ØÀàÐÍ£¬µ«·µ»ØÀàÐͱ¾Éí²»×ãÒÔÇø·Ö·½·¨µÄÁ½¸ö°æ
±¾¡£ ......