java homework
ʹÓÃjava.lang.MathÀ࣬Éú³É500¸ö0~99µÄËæ»úÊý£¬½øÐÐÅÅÐòÊä³ö£¬²¢Çó×î´óÖµ¡¢×îСֵ¡¢Æ½¾ùÖµ¡¢±ê×¼²î¡¢·½²î¡¢¾ù·½²î£»
import java.lang.Math;
import java.util.Arrays;
public class Main {
public static void main(String args[]) {
//create random
int [] data =new int[500];
double sum = 0, avg =0;
System.out.println("DATE:");
for(int i=0; i<500; ++i) {
data[i] = (int ) (Math.random() * 100);
System.out.print(data[i] + "\t");
if(0==(i+1)%8)
System.out.println();
}
System.out.println("\nAfter sort:");
//sort
Arrays.sort(data);
for(int i=0; i<500; ++i) {
sum += data[i];
System.out.print(data[i] + "\t");
if(0==(i+1)%8)
System.out.println();
}
System.out.println();
avg = sum/(500);
double sum2= 0;
for(int i=0; i<500; ++i) {
sum2 += Math.pow((double)data[1] - avg,2);
}
double var = sum2 / 500;
double sd = Math.sqrt(var);
System.out.println("Min:" + data[0]);
System.out.println("Max:" + data[499]);
System.out.println("Variance:" + var);
System.out.println("Sd:"+ sd);
}
}
Ïà¹ØÎĵµ£º
Ê×ÏÈ´ò¿ªÃüÁîÐÐÈ·¶¨ÃüÁîÐеĺ¯ÊýÊÇ·ñ¿ÉÒÔÓã¬ÔÚÃüÁîÐÐÀïÃæÊäÈëjar Èç¹û¿ÉÒÔÓþͻá³öÏÖÃüÁîjarµÄ¸÷¸ö²ÎÊýÑ¡Ôñ¹æÔò£¬ºÍÒ»¸öСÎÊÌ⣬ÎÒÓöµ½µÄÎÊÌâÊÇÓÐÒ»¸öµ¥¶ÀµÄclassÎļþ ûÓÐÔ´Îļþ£¬³ÌÐòÒªÔÚnetbeanÀïÃæµ÷ÓÃÕâ¸öclassÎļþ£¬¶øÎÒ²»ÖªµÀnetbeanÈçºÎÒýÓÃÕâ¸öclassÎļþÁË ¾ÍÖ»ºÃ°Ñclass´ò°ü³ÉjarÁË£¬
Ê×ÏÈÎÒÔÚCÅÌÀïÃ潨Á¢Á˸öÎ ......
ͨ³£Çé¿öÏ£¬ÎÒÃÇÔÚ±àдjavaÎļþʱ£¬»áÓÐÒýÓõ½×ÔÒѶ¨ÒåµÄһЩÀ࣬Èç¹û°´Í¨³£µÄjavac *.javaµÄÐÎʽÀ´±àÒë»á³öÏÖÕÒ²»µ½·ûºÅµÄ´íÎó¡£
ÒÔÏÂÌṩÁËÁ½ÖÖ·½·¨£¬ÒÔ¹©²Î¿¼
¼ÙÈçÔÚd:\web\wshÏÂÓÐa.javaºÍb.javaÁ½¸öÎļþ£¬ÔÚb.javaÎļþÖÐÓÐÒýÓÃÁËa.java¡£ÏÂÃæÊDZàÒëµÄ·½·¨
·½·¨Ò»:
½øÈëd:\web\wshÏ£º javac a.java
È»ºóÍ˳öwshÄ ......
JAVAÊÇÒ»ÖÖ±à³ÌÓïÑÔ£¬Ò»ÖÖ¿ª·¢»·¾³£¬Ò»ÖÖÓ¦Óû·¾³£¬Ò»ÖÖ²¿Êð»·¾³£¬Ò»Öֹ㷺ʹÓõÄÍøÂç±à³ÌÓïÑÔ£¬ËüÊÇÒ»ÖÖ¼ÆËã¸ÅÄî¡£
×é³ÉJavaµÄ3¸ö·ÖÖ§£º
J2SE(Java 2 Platform Standard Edition):Java±ê×¼°æ£¬°üº¬¹¹³ÉJAVAÓïÑÔºËÐÄ ......
н¨javaÏîÄ¿£¬ÐèÒª½¨Á¢ÈçͼËùʾµÄ°ü½á¹¹£¨ÕâͼÊǺóÃæ²¹Éϵģ¬ËùÒÔÀïÃæÓн¨ºÃµÄÀࣩ£º
µã»÷ÏîÄ¿£¬ÓÒ¼üÑ¡Ôñ-¡·ÊôÐÔ-¡·Ìí¼Ó×Ô¶¨Òå¿â£º
¼á³ÖÒÔ×îÉÙ°üÔÔò£¬ÀýÈ磺
Íê³ÉÈçÏÂͼËùʾ£º
ÏîÄ¿½á¹¹´óÖÂÈçÏ£º
¶ÔBookService½ ......
1. ¶Ô×Ô¼ºµÄ×ܽáºÍÀí½âµÄÉý»ªÊÇÎÒϲ»¶×öµÄÒ»¼þÊ£¬ÔÚʵ¼ÊÏîÄ¿¹ý³ÌÖУ¬ºÜ¶àµØ·½¶¼Óõ½¶¯Ì¬Éú³ÉÊ÷Ðβ˵¥µÄµØ·½£¬ÏÖÔھ͸ø´ó¼Ò½²½²ÈçºÎ¶¯Ì¬Éú³ÉÒ»¿ÃÊ÷¡£
2. Ê×ÏÈÎÒÃDZØÐëÒª½¨Á¢Ê÷µÄ½ÚµãÄ£ÐÍ£¬ÆäʵÊ÷µÄ½ÚµãÄ£ÐÍÖÐÍùÍù¾ÍÊÇÎÒÃÇÐèÒª´æ·ÅµÄÊý¾Ý¶ÔÏó£¬ºÜ ......