# 小题目一道 帮帮忙

zrmzhang 2010-04-24 01:32:36

50 - 59 PA
60 - 69 CR
70 - 79 DI
80 - 100 HD

Welcome to the student course admin
How many subjects are there?: 2

Collecting information for subject 0
How many assessments are there for this subject?: 2
Subject Mark: 65 - CR

Collecting information for subject 1
How many assessments are there for this subject?: 3
Subject Mark: 75 - DI

Student Average Mark is 70

...全文
287 22 打赏 收藏 转发到动态 举报

22 条回复

• 打赏
• 举报

zqfddqr 2010-04-30
• 打赏
• 举报

.................................
sqcyg 2010-04-28
• 打赏
• 举报

liu_liyang 2010-04-28
• 打赏
• 举报

zhuyouyong 2010-04-28
• 打赏
• 举报

[/Quote]
zrmzhang 2010-04-28
• 打赏
• 举报

``````import java.util.Scanner;

public class Course
{
private static Scanner sc;
public static void main(String []args)
{
System.out.print("How many subjects are there：");
int[][]subjectnum=new int[getsubjectnum()][];
int[]average=new int[subjectnum.length];
for(int i=0;i<subjectnum.length;++i)
{
System.out.print("For Subject"+(i+1)+" How many assessments are there:");
Scanner  sc=getsc();
int a=sc.nextInt();
subjectnum[i]=new int[a];
System.out.print("For Subject"+(i+1)+" plesae enter the assessments the following\n");
average[i]=kaoping(subjectnum[i].length,i+1);
System.out.println("For Subject"+(i+1)+" average mark is:"+average[i]+"\n");
}
System.out.print("There are the average mark for all subject\n");
for(int i=0;i<average.length;++i)
System.out.print("Subject"+(i+1)+"'s average mark is:"+average[i]+"\n");
System.out.println("The average mark for all subject is:"+addsorce(average));
}
static int getsubjectnum()
{
Scanner sc=getsc();
int a=sc.nextInt();
return a;
}
static Scanner getsc()
{
if(sc==null){sc=new Scanner(System.in);return sc;}
else return sc;
}
static int kaoping(int n,int j)
{
int sum=0,ave;
Scanner sc=getsc();
for(int i=0;i<n;++i)
{
System.out.print("Please enter subject"+j+"'s No."+(i+1)+"'s assessment mark:");
sum+=sc.nextInt();
}
ave=sum/n;
switch(ave/10)
{
case 8:System.out.print("The sorce is HD\n");break;
case 7:System.out.print("The sorce is DI\n");break;
case 6:System.out.print("The sorce is HD\n");break;
case 5:System.out.print("The sorce is CR\n");break;
default:System.out.print("The sorce is NN\n");break;
}
return ave;
}
{
int sum=0;
for(int i=0;i<a.length;sum+=a[i],++i);
return sum/a.length;
}
} ``````

lyh200731 2010-04-25
• 打赏
• 举报

cjf068 2010-04-25
• 打赏
• 举报

huaye 2010-04-24
• 打赏
• 举报

new_bird_pjj 2010-04-24
• 打赏
• 举报

springbird 2010-04-24
• 打赏
• 举报

• 打赏
• 举报

kxl1021416743 2010-04-24
• 打赏
• 举报

• 打赏
• 举报

[Quote=引用 5 楼 creazyjava 的回复:]

[/Quote]

• 打赏
• 举报

charles361 2010-04-24
• 打赏
• 举报

canoe982 2010-04-24
• 打赏
• 举报

Mars_Ma_OK 2010-04-24
• 打赏
• 举报

amdgaming 2010-04-24
• 打赏
• 举报

• 打赏
• 举报

62,613

• 近7日
• 近30日
• 至今