Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

JavaÀàÇó½âÒ»Ôª¶þ´Î·½³ÌµÄ¸ù

 Ù¡Ç¿ http://blog.csdn.net/microtong
 OakCMSÄÚÈݹÜÀíϵͳ http://www.oakcms.cn http://www.oakcms.net
Ò»Ôª¶þ´Î·½³Ìax2+bx+c=0£¬ÊäÈëa,b,cÈý¸öϵÊý£¬Çó½â·½³Ì£¬½á¹ûÓÐÈýÖÖÇé¿ö£ºÁ½¸öʵÊý¸ù¡¢Ò»¸öʵÊý¸ù¡¢Á½¸ö¸´Êý¸ù¡£
/**
 * Equation.java
 */
package cn.edu.uibe.oop;
/**
 * ¼ÆËãÒ»Ôª¶þ´Î·½³ÌµÄ¸ù
 * @author TongQiang
 *
 */
public class Equation {
 double a,b,c; //·½³ÌµÄϵÊý
 double x1,x2; //Á½¸ö¸ù
 double r;     //ʵ²¿
 double v;     //Ð鲿
 int type;     //0±íʾһ¸ö¸ù£¬1±íʾÁ½¸öʵ¸ù£¬2±íʾÁ½¸ö¸´ÊýµÄ¸ù
 public Equation(double a,double b,double c){
  this.a = a;
  this.b = b;
  this.c = c;
 }
 private double delta(){
  return b*b-4*a*c;
 }
 public void calculate(){
  double d = delta();
  if(Math.abs(d) < 1E-5){
   type = 0;
   x1 = -b/(2*a);
   x2 = x1;
  }else if(d > 0){
   type = 1;
   x1 = (-b+Math.sqrt(d))/(2*a);
   x2 = (-b-Math.sqrt(d))/(2*a);
  }else{
   type = 2;
   r =  -b/(2*a);
   v = Math.sqrt(-d)/(2*a);
  }
 }
 public void showResult(){
  switch(type){
  case 0:
   System.out.println("·½³ÌÖ»ÓÐÒ»¸öʵ¸ù£¬x1=x2="+x1);
   break;
  case 1:
   System.out.println("·½³ÌÓÐÁ½¸öʵ¸ù£¬·Ö±ðÊÇ£ºx1="+x1+"\tx2="+x2);
   break;
  case 2:
   System.out.println("·½³ÌÓÐÁ½¸ö¸´Êý¸ù£¬·Ö±ðÊÇ£º"+r+"+"+v+"i,\t"+r+"-"+v+"i");
   break;
  }
 }
 public static void main(String[] args) {
  Equation eq1 = new Equation(1,2,2);
  eq1.calculate();
  eq1.showResult();
 &nbs


Ïà¹ØÎĵµ£º

JAVA±éÀúÒ»¸öÎļþ¼ÐÖеÄËùÓÐÎļþ

ÔÚʵ¼ÊÏîÄ¿Öиø¶¨Ò»Îļþ¼Ð£¬µÃµ½Õâ¸öÎļþ¼ÐÏÂËùÓеÄÎļþÕâÑùµÄÐèÇó²¢²»ÊǺܶ࣬¸ü¶àµÄÊDzéÕÒ»òÊÇɾ³ýijһ¾ßÌåµÄÎļþ
import java.io.File;
import java.util.ArrayList;
public class FileTest {
 private static ArrayList<String> filelist = new ArrayList<String>();
 
 public stati ......

¹ØÓÚJavaÖÐ×Ô¶¨Òå°üµÄ´´½¨

ÎÒÔÚѧϰthinking in Java4 µÄʱºò£¬ÔÚ´´½¨×Ô¶¨Òå°üµÄʱºò£¬Åöµ½Á˺ܶà´íÎó£¬ÈÃÎÒÓôÃÆÁ˼¸Ì죬ͨ¹ýÔÚÍøÉϵÄ×ÊÁÏËÑË÷£¬°Ñ°üµÄ´´½¨¹ý³Ì¸ø´ó¼ÒÏêϸÁгöÀ´¡£
ÎÒÃÇÒÔthinking in Java4ÖеÄÀý×ÓΪÀý
´´½¨Á½¸öÀàVectorºÍList¡£½«±àÒëºóµÄVector.classºÍList.classÎļþ·ÅÔÚ°ünet.mindview.simpleÏÂ(¸Ã°üλÓÚc:\DOC\JavaT).
//Vec ......

ÔÚJavaÖÐÀûÓÃcglibʵÏÖ´úÀí


    ÔÚÉÏһƪÎÄÕ¡¶ÔÚJavaÖÐÀûÓö¯Ì¬´úÀíʵÏÖÊý¾Ý¿âÁ¬½ÓÓëÊÂÎñµÄ×Ô¶¯¹ÜÀí¡·½²ÊöÁËÈçºÎʹÓÃJava¶¯Ì¬´úÀí£¬µ«ÒªÇó±»´úÀí¶ÔÏóҪʵÏÖÒ»¸ö½Ó¿Ú£¬Èç¹û²»ÏëʵÏÖ½Ó¿ÚÔõô°ìÄØ£¿Ê¹ÓÿªÔ´µÄcglib¿ÉÒÔʵÏÖ¶ÔÒ»¸öÀà¶ÔÏóµÄ´úÀí£¬¶ø²»ÒªÇóʵÏÖ½Ó¿Ú¡£
    cglib£¨Code Generation Library£©Äܹ»ÔÚ³ÌÐòÔË ......

javaÓÅÊƼ°¿çƽ̨ԭÀí

Ò»¡£javaµÄÓÅÊÆ
1.ÃæÏò¶ÔÏó
2.¿çƽ̨
java×÷ΪһÖÖÍøÂçÓïÑÔ£¬ÆäÔ´´úÂë±»±àÒë³É.class×Ö½ÚÂ룬ÓÉjavaÐéÄâ»úÖ´ÐУ¬
3.¼òµ¥
Ò»£¬java·ç¸ñÀàËÆc++£¬c++³ÌÐòÔ±ÄܺܿìµØÕÆÎÕjava
¶þ£¬javaÞðÆúÁËÖ¸Õ룬½á¹¹£¬Ã¶¾ÙµÈÒ×Òý·¢ÄÚ´æÎÊÌâµÄ²Ù×÷
Èý£¬javaÌṩÁ˷ḻµÄapi£¬Äܹ»°ïÖúÎÒÃÇ¿ìËÙ¿ª·¢
4.½¡×³
Ò»¡£Ç¿ÀàÐ͵ģ¬ÀàÐͼì²éºÜÑ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ