小题目一道 帮帮忙

zrmzhang 2010-04-24 01:32:36
编写出java程序

要求:学生有若干门学科 每门学科有若干次考试

将考试分数相加的总分评估等第

学科评估标准如下:
低于50 NN
50 - 59 PA
60 - 69 CR
70 - 79 DI
80 - 100 HD


执行的时候会先要求输入有几门学科
然后输入学科1的考试数量
然后依次输入各次考试的分数
最后总分评估出等级

在输入学科2的考试次数
然后依次输入各次考试的分数
最后总分评估出等级

最后算出学科1和学科2的平均分

例如:
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
Please enter assessment mark: 5
Please enter assessment mark: 60
Subject Mark: 65 - CR


Collecting information for subject 1
How many assessments are there for this subject?: 3
Please enter assessment mark: 10
Please enter assessment mark: 25
Please enter assessment mark: 40
Subject Mark: 75 - DI

Student Average Mark is 70

文件名为course.java
最好使用到evaluate(),getValidNum(),printMarkGrade()
调用函数evaluateSubject()

...全文
289 22 打赏 收藏 转发到动态 举报
写回复
用AI写文章
22 条回复
切换为时间正序
请发表友善的回复…
发表回复
麦穗 2010-04-30
  • 打赏
  • 举报
回复
这个还是自己多谢谢~~!
zqfddqr 2010-04-30
  • 打赏
  • 举报
回复
.................................
sqcyg 2010-04-28
  • 打赏
  • 举报
回复
书上有类似的例题吧 依葫芦画瓢
liu_liyang 2010-04-28
  • 打赏
  • 举报
回复
菜鸟关注一下
zhuyouyong 2010-04-28
  • 打赏
  • 举报
回复
顶[Quote=引用 7 楼 mars_ma_ok 的回复:]
勤快的啦..现在辛苦将来就舒服啦!!!
[/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;
}
static float addsorce(int[]a)
{
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
  • 打赏
  • 举报
回复
楼主努力,这是作业题,还是自己动脑做出来较好
秋9 2010-04-24
  • 打赏
  • 举报
回复
楼主努力哈,不能误人子弟啊
kxl1021416743 2010-04-24
  • 打赏
  • 举报
回复
好懒啊 不行啊
notlogin 2010-04-24
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 creazyjava 的回复:]

楼主有点偷懒了~~~
[/Quote]
怎么能是有点偷懒?那事相当懒了……
  • 打赏
  • 举报
回复
学习,与君共勉!!!
charles361 2010-04-24
  • 打赏
  • 举报
回复
这么简单的东西自己弄吧!没人有时间给你弄这个
canoe982 2010-04-24
  • 打赏
  • 举报
回复
感觉就是作业题。LZ自己试试先啊。要是有些小问题,再拿来问吧。
Mars_Ma_OK 2010-04-24
  • 打赏
  • 举报
回复
勤快的啦..现在辛苦将来就舒服啦!!!
amdgaming 2010-04-24
  • 打赏
  • 举报
回复
呵呵。。。。。作业题
带头大哥 2010-04-24
  • 打赏
  • 举报
回复
这应该是大一就应该会的吧,楼主还是自己研究一样吧,没什么难的,自己做一回就知道有多简单了
加载更多回复(2)

62,624

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧