真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

統(tǒng)計(jì)獲獎(jiǎng)名單java代碼,統(tǒng)計(jì)獲獎(jiǎng)名單java代碼查詢

求大神幫忙編個(gè)JAVA,用來(lái)統(tǒng)計(jì)成績(jī)的程序

可憐的小娃娃啊。哥幫你寫了。先看效果圖(綠色為輸入):

承德網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),承德網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為承德成百上千提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\外貿(mào)網(wǎng)站制作要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的承德做網(wǎng)站的公司定做!

代碼如下:

package zhidao;

import java.util.Scanner;

public class TestCount {

public static void main(String[] args) {

double total = 0;

int count = 0;

int max = -1;

int min = 11;

int countOthers = 0;

int count6 = 0;

int count7 = 0;

int count8 = 0;

int count9 = 0;

int count10 = 0;

Scanner scanner = new Scanner(System.in);

String line = null;

while(true){

?System.out.println("Choose (A: add scores), (N: new scores), or (Q: quit)");

?line = scanner.nextLine();

?if(line.equalsIgnoreCase("Q")){

??? ?break;

?}else if(line.equalsIgnoreCase("N")){

??? ?total = 0;

??? ?count = 0;

??? ?max = -1;

??? ?min = 11;

??? ?countOthers = 0;

??? ?count6 = 0;

??? ?count7 = 0;

??? ?count8 = 0;

??? ?count9 = 0;

??? ?count10 = 0;

??? ?System.out.println("Type the additional scores in single line");

??? ?line = scanner.nextLine();

??? ?

?}else if(line.equalsIgnoreCase("A")){

??? ?System.out.println("Type a new list of scores in single line");

??? ?line = scanner.nextLine();

?}

?String[] datas = line.split(" ");

?for (String data : datas) {

??? ?if(!data.matches("^\\d+$")){

??? ??? ?continue;

??? ?}

??? ?int d = Integer.parseInt(data);

??? ?if(d 0 || d 10){

??? ??? ?continue;

??? ?}

??? ?total += d;

??? ?count++;

??? ?if(max d){

??? ??? ?max = d;

??? ?}

??? ?if(min d){

??? ??? ?min = d;

??? ?}

??? ?switch (d) {

??? ?case 10:

??? ??? ?count10++;

??? ??? ?break;

??? ?case 9:

??? ??? ?count9++;

??? ??? ?break;

??? ?case 8:

??? ??? ?count8++;

??? ??? ?break;

??? ?case 7:

??? ??? ?count7++;

??? ??? ?break;

??? ?case 6:

??? ??? ?count6++;

??? ??? ?break;

??? ?default:

??? ??? ?countOthers++;

??? ??? ?break;

??? ?}

?}

?System.out.println("\n------------------------");

?System.out.println("? 6|" + nStart(countOthers));

?System.out.println("?? 6|" + nStart(count6));

?System.out.println("?? 7|" + nStart(count7));

?System.out.println("?? 8|" + nStart(count8));

?System.out.println("?? 9|" + nStart(count9));

?System.out.println("? 10|" + nStart(count10));

?System.out.printf("Average = %5.2f\n",total/count);

?System.out.printf("Maximum = %5d\n",max);

?System.out.printf("Minimum = %5d\n",min);

?System.out.println("------------------------\n");

}

System.out.println("*** End of program ***");

}

private static String nStart(int count) {

String s = "";

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

?s += "*";

}

return s;

}

}

有疑問請(qǐng)追問或私信我,沒有用list和數(shù)組,望采納。

java編寫一個(gè)成績(jī)統(tǒng)計(jì)程序

import java.util.Scanner;

public class test {

static int s;

public static void main(String[] argv) {

int [] num=new int[20];

Scanner scanner=new Scanner(System.in);

Integer a;

int i;

for(i=1;i=20;i++){

System.out.println("請(qǐng)輸入第"+i+"一個(gè)分?jǐn)?shù)(結(jié)束請(qǐng)輸入520嘿嘿):");

a=scanner.nextInt();

num[i-1]=a;

if(a==520){

break;

}

}

for(int m=0;mi-1;m++)

{

s=s+num[m];

}

System.out.println("總共錄入了"+(i-1)+"個(gè)分?jǐn)?shù)");

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

System.out.println("平均分是"+s/(i-1)+"分");

for(Integer m=0;mnum.length-1;m++)

{ if(num[m]0num[m]!=520){

if(num[m]=90)

System.out.println(num[m]+"優(yōu)秀");

else if(num[m]=80)

System.out.println(num[m]+"良好");

else if(num[m]=70)

System.out.println(num[m]+"中等");

else if(num[m]=60)

System.out.println(num[m]+"及格");

else

System.out.println(num[m]+"不及格");

}else break;

}

}

}

我的代碼很簡(jiǎn)潔,采納我唄。。。

Java代碼實(shí)現(xiàn)抽獎(jiǎng):從班級(jí)的學(xué)號(hào)中抽出一個(gè)一等獎(jiǎng),兩個(gè)二等獎(jiǎng),三個(gè)三等獎(jiǎng)

抽取問題, 重點(diǎn)是 同一個(gè)學(xué)號(hào)不能重復(fù)被抽取.

解決辦法很多,

比如數(shù)組可以使用下標(biāo)來(lái)標(biāo)記,號(hào)碼是否被使用,使用了就繼續(xù)下一次抽取

也可以使用集合來(lái)抽取,把集合順序打亂,然后隨便抽幾個(gè)就可以了

參考代碼:數(shù)組法

import?java.util.Random;

public?class?Test?{

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

int?stuNums=30;

int[]?nums=new?int[stuNums];//存儲(chǔ)學(xué)號(hào)的數(shù)組

boolean[]?flags=new?boolean[stuNums];//標(biāo)記,用于標(biāo)記對(duì)應(yīng)下標(biāo)的學(xué)號(hào)是否已經(jīng)被抽取過了

for?(int?i?=?0;?i??stuNums;?i++)?{

nums[i]=i+1;//給學(xué)號(hào)賦值

}

Random?r=new?Random();

while(true){

int?index?=?r.nextInt(stuNums);

if(!flags[index]){

System.out.println("A等:"+nums[index]);

flags[index]=true;?//標(biāo)記已經(jīng)被使用過了

break;

}

}

for?(int?i?=?0;?i??2;?i++)?{

int?index?=?r.nextInt(stuNums);

if(!flags[index]){

System.out.println("B等:"+nums[index]);

flags[index]=true;

}else{

i--;//如果已經(jīng)被抽取過了?,那么i建議,再次循環(huán)

}

}

for?(int?i?=?0;?i??3;?i++)?{

int?index?=?r.nextInt(stuNums);

if(!flags[index]){

System.out.println("c等:"+nums[index]);

flags[index]=true;

}else{

i--;

}

}

}

}

集合法

import?java.util.ArrayList;

import?java.util.Collections;

public?class?Test2?{

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

int?stuNums=20;

ArrayListInteger?list=new?ArrayListInteger();

for?(int?i?=?0;?i??stuNums;?i++)?{

list.add(i+1);

}

System.out.println("有序"+list);

Collections.shuffle(list);//打亂順序

System.out.println("亂序"+list);

System.out.println("A等"+list.get(0));

System.out.println("B等"+list.get(1));

System.out.println("B等"+list.get(2));

System.out.println("C等"+list.get(3));

System.out.println("C等"+list.get(4));

System.out.println("C等"+list.get(5));

}

}


分享名稱:統(tǒng)計(jì)獲獎(jiǎng)名單java代碼,統(tǒng)計(jì)獲獎(jiǎng)名單java代碼查詢
網(wǎng)頁(yè)URL:http://weahome.cn/article/dschspp.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部