java答題計(jì)分代碼 java答題系統(tǒng)

java 編程題:代碼怎么寫(xiě)?

我求出來(lái)了3組解

創(chuàng)新互聯(lián)公司專(zhuān)業(yè)為企業(yè)提供蘇家屯網(wǎng)站建設(shè)、蘇家屯做網(wǎng)站、蘇家屯網(wǎng)站設(shè)計(jì)、蘇家屯網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)與制作、蘇家屯企業(yè)網(wǎng)站模板建站服務(wù),十年蘇家屯做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。

0010110011

0111010000

1011010000

沒(méi)驗(yàn)證 ,你自己去驗(yàn)證,呵呵

public class Main {

/**

* @param args

*/

private static int score = 10;

private static int[] test = new int[10];

public static void main(String[] args) {

// TODO Auto-generated method stub

for(int a =0 ; a = 1; a++){

for(int b =0 ; b = 1; b++){

for(int c =0 ; c = 1; c++){

for(int d =0 ; d = 1; d++){

for(int e =0 ; e = 1; e++){

for(int f =0 ; f = 1; f++){

for(int g =0 ; g = 1; g++){

for(int h =0 ; h = 1; h++){

for(int i =0 ; i = 1; i++){

for(int j =0 ; j = 1; j++){

test[0] = a;

test[1] = b;

test[2] = c;

test[3] = d;

test[4] = e;

test[5] = f;

test[6] = g;

test[7] = h;

test[8] = i;

test[9] = j;

fun();

if(score == 100){

for(int k =0 ;k 10 ;k++)

System.out.print(test[k]);

System.out.print("\n");

}

score = 10;

}

}

}

}

}

}

}

}

}

}

}

private static void fun(){

for(int i=0 ;i 10 ;i++){

if(test[i] == 1){

score *= 2;

}else{

score -= (i+1);

}

}

}

}

JAVA代碼問(wèn)題!輸入5名學(xué)生的成績(jī),并計(jì)算總成績(jī),平均分,最高分,最低分

public static void main(String[] args) {

double scores[] = new double[5];

double total = 0;

double avg = 0;

double max = 0;

double min = 0;

int count=0;

String inputStr=null;

System.out.println("請(qǐng)輸入5名學(xué)生的成績(jī):");

Scanner input = new Scanner(System.in);

while(count5){

try{

if(count 5){

System.out.println("請(qǐng)輸入第"+(count+1)+"個(gè)分?jǐn)?shù):");

}

inputStr=input.nextLine();

scores[count++]=Double.valueOf(inputStr.trim());

}catch(Exception e){

if(inputStr!=null "exit".equals(inputStr.trim())){

System.out.println("您已成功結(jié)束程序");

System.exit(0);

}

System.out.println("若想結(jié)束請(qǐng)輸入:exit");

System.out.print("您輸入的分?jǐn)?shù)不是數(shù)值類(lèi)型,");

count--;

}

}

input.close();

Arrays.sort(scores);

min=scores[0];

max=scores[scores.length-1];

for(double score :scores){

total += score;

}

avg=total/scores.length;

System.out.println("總成績(jī)是" + total);

System.out.println("最高分是" + max);

System.out.println("最低分是" + min);

System.out.println("平均分是" + avg);

}

//-------------------------------------------------------------------------

public static void main(String[] args) {

Scanner input = new Scanner(System.in);

while(true){

Double[] scores = null;

double total = 0;

double avg = 0;

double max = 0;

double min = 0;

int count=1;

ListDouble inputScores=new ArrayListDouble();

String inputStr=null;

System.out.println("請(qǐng)輸入要統(tǒng)計(jì)學(xué)生的成績(jī)(理論上可以輸入無(wú)限個(gè),前提是你有那么大的內(nèi)存):");

while(true){

try{

System.out.println("請(qǐng)輸入第"+count+++"個(gè)分?jǐn)?shù),或輸入ok進(jìn)行計(jì)算,離開(kāi)請(qǐng)輸入exit");

inputStr=input.nextLine();

inputScores.add((double)Double.valueOf(inputStr.trim()));

}catch(Exception e){

if(inputStr!=null "exit".equals(inputStr.trim().toLowerCase())){

System.out.println("您已成功結(jié)束程序");

input.close();

System.exit(0);

}

if(inputStr!=null "ok".equals(inputStr.trim().toLowerCase())){

break;

}

System.out.println("您輸入的分?jǐn)?shù)不是數(shù)值類(lèi)型,");

System.out.println("若想結(jié)束請(qǐng)輸入exit ,若想計(jì)算結(jié)果請(qǐng)輸入ok");

count--;

}

}

if(inputScores.size()==0){

System.out.println("您沒(méi)有輸入學(xué)生成績(jī),無(wú)數(shù)據(jù)可統(tǒng)計(jì),程序結(jié)束。");

return ;

}

scores=inputScores.toArray(new Double[inputScores.size()]);

Arrays.sort(scores);

min=scores[0];

max=scores[scores.length-1];

for(double score :scores){

total += score;

}

avg=total/scores.length;

System.out.println("總成績(jī)是" + total);

System.out.println("最高分是" + max);

System.out.println("最低分是" + min);

System.out.println("平均分是" + avg);

}

}

java練習(xí)題求完整代碼

按照題目要求編寫(xiě)的用javaBean規(guī)范設(shè)計(jì)的學(xué)生類(lèi)Student的Java程序如下

需要?jiǎng)?chuàng)建user.java.test包,把Student.java文件和Test.java文件放入包中,編譯Student.java文件并且編譯運(yùn)行Test.java文件得到運(yùn)行結(jié)果

Student.java文件代碼如下

package user.java.test;

import java.io.Serializable;

public class Student implements Serializable{

private static final long serialVersionUID = 1L;

private String no;

private String name;

private double score;

public Student(){}

public Student(String no,String name,double score){

this.no=no;

this.name=name;

this.score=score;

}

public String getNo(){ return no;}

public void setNo(String no){ this.no=no;}

public String getName(){ return name;}

public void setName(String name){ this.name=name;}

public double getScore(){ return score;}

public void setScore(double score){ this.score=score;}

public String toString(){

return "學(xué)號(hào):"+no+",姓名:"+name+",成績(jī):"+score;

}

public static double getAvg(Student[] sArray){

double sum=0,avg;

for(int i=0;isArray.length;i++){

sum=sum+sArray[i].getScore();

}

avg=sum/sArray.length;

return avg;

}

}

Test.java文件代碼如下

package user.java.test;

public class Test{

public static void main(String[] args){

Student[] sArray=new Student[5];

sArray[0]=new Student("001","張三",89.5);

sArray[1]=new Student("002","李四",82.5);

sArray[2]=new Student("003","王五",93);

sArray[3]=new Student("004","趙六",73.5);

sArray[4]=new Student("005","孫七",66);

System.out.println("這些學(xué)生的平均分:"+Student.getAvg(sArray));

for(int i=0;isArray.length;i++){

System.out.println(sArray[i].toString());

}

}

}

求JAVA評(píng)委打分代碼

正好我閑著,給你寫(xiě)一個(gè)吧。

我寫(xiě)的這個(gè)評(píng)委分?jǐn)?shù)是在代碼里固定到數(shù)組里了,如果你需要運(yùn)行時(shí)手動(dòng)輸入評(píng)分,可以將oldScores里的數(shù)據(jù)改成手動(dòng)輸入就行了(這個(gè)不用我再寫(xiě)了吧,如果不會(huì)再追問(wèn),再告訴你)。

你先新建一個(gè)類(lèi),將下面的main方法全部復(fù)制進(jìn)去就能運(yùn)行了,自己看一下吧。

/**?主方法?*/

public?static?void?main(String[]?args)

{

/**?保存原始評(píng)分的數(shù)組(如果你需要運(yùn)行時(shí)手動(dòng)輸入分?jǐn)?shù),將?oldScores中的數(shù)據(jù)改成手動(dòng)輸入就行了?*/

double[]?oldScores?=?{15,?77,?55,?88,?79,?98,?67,?89,?68,?88};

/**?最終將用來(lái)保存排序后的數(shù)組?*/

double[]?scores?=?new?double[oldScores.length];

double?temp;

/**?平均分?*/

double?avg?=?0;

int?k;

/**?將原始評(píng)分放入最終排序數(shù)組?*/

for?(int?i?=?0;?i??oldScores.length;?i++)

{

scores[i]?=?oldScores[i];

}

/**?開(kāi)始排序?*/

for?(int?i?=?0;?i??scores.length?-?1;?i++)

{

k?=?i;

for?(int?j?=?i?+?1;?j??scores.length;?j++)

{

if?(scores[k]??scores[j])

{

k?=?j;

}

}

if?(i?!=?k)

{

temp?=?scores[k];

scores[k]?=?scores[i];

scores[i]?=?temp;

}

}

/**?計(jì)算去掉最高分和最低分之后的和?*/

double?sum?=?0;

/**?記錄計(jì)算平均分的分?jǐn)?shù)個(gè)數(shù)?*/

double?num?=?0;

for?(int?i?=?1;?i??scores.length?-?1;?i++)

{

num++;

sum?+=?scores[i];

}

/**?計(jì)算平均分?*/

avg?=?sum?/?num;

/**?最公平的肯定不是在scores數(shù)組兩端?*/

double?zgp?=?0;

double?cha?=?0;

/**?標(biāo)記與平均值差值最小的分?jǐn)?shù)位置?*/

int?flag?=?0;

/**?開(kāi)始尋找最公平評(píng)分?*/

for?(int?i?=?1;?i??scores.length?-?1;?i++)

{

/**?為cha賦初始值,注意比較差值要使用絕對(duì)值比較?*/

if?(i?==?1)

{

cha?=?Math.abs(scores[i]?-?avg);

}

double?cha1?=?Math.abs(scores[i]?-?avg);

if?(cha1??cha)

{

cha?=?cha1;

flag?=?i;

}

}

zgp?=?scores[flag];

/**?由于最不公平的分?jǐn)?shù)肯定在scores數(shù)組的第一個(gè)或者是最后一個(gè)?*/

double?bgp?=?0;

if?(Math.abs(scores[0]?-?avg)??Math.abs(scores[scores.length?-?1]?-?avg))

{

bgp?=?scores[0];

}

else

{

bgp?=?scores[scores.length?-?1];

}

/**?全部計(jì)算完成,下面開(kāi)始輸出結(jié)果?*/

System.out.println("原始評(píng)委分?jǐn)?shù)如下:");

for?(int?i?=?0;?i??oldScores.length;?i++)

{

System.out.print(oldScores[i]?+?",?");

}

System.out.println();

System.out.println("排序后分?jǐn)?shù)如下:");

for?(int?i?=?0;?i??scores.length;?i++)

{

System.out.print(scores[i]?+?",?");

}

System.out.println();

System.out.println("去掉最高分和最低分后平均分:"?+?avg);

System.out.println("最公平分?jǐn)?shù):"?+?zgp);

System.out.println("最不公平分?jǐn)?shù):"?+?bgp);

}

本文名稱(chēng):java答題計(jì)分代碼 java答題系統(tǒng)
URL地址:http://www.bm7419.com/article34/ddcsjpe.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動(dòng)網(wǎng)站建設(shè)、品牌網(wǎng)站設(shè)計(jì)軟件開(kāi)發(fā)、外貿(mào)網(wǎng)站建設(shè)營(yíng)銷(xiāo)型網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

小程序開(kāi)發(fā)