悉心求教:java要求用图形用户的方法。有五个学生,每个学生有3门课的成绩,从键盘输入以上数据(包括学号、姓名、三门课成绩),计算出平均成绩,

zs1003 2015-06-15 10:07:22
有五个学生,每个学生有3门课的成绩,从键盘输入以上数据(包括学号、姓名、三门课成绩),计算出平均成绩,把原有的数据和计算出的平均分数存放在磁盘文件”stud”中。要求用图形用户界面完成。
...全文
1421 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
zs1003 2015-06-16
  • 打赏
  • 举报
回复
大哥是的,可是我没到办法去解决
  • 打赏
  • 举报
回复
大学课程设计是吗?
zs1003 2015-06-16
  • 打赏
  • 举报
回复
可是不知道怎么结合图形界面
zs1003 2015-06-16
  • 打赏
  • 举报
回复
import java.io.*; class Score{ String[] name = new String[5]; double[] score = new double[5]; double[] sum = new double[5]; public void input() throws IOException{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); boolean change =true; while(change){ try{ for(int i = 0;i <= 4;i++){ System.out.print("Input the name : "); name[i] = br.readLine(); for(int j = 0;j <= 2;j++){ System.out.print("Input "+(j+1)+" score : "); score[j] = Integer.parseInt(br.readLine()); } System.out.println(); sum[i] = score[0]+score[1]+score[2]; } change =false; } catch(NumberFormatException nfe){ System.out.println("Sorry,The Score only can input a number,Please input again."); } } } public void compositor() throws IOException{ FileWriter fw = new FileWriter("F://stud.txt"); //文件存放于f盘下的"stud.txt"文件下; BufferedWriter bw = new BufferedWriter(fw); double temp1; String temp2; for(int i = 0;i < 4;i++){ for(int j = 1;j < 5-i;j++){ if(sum[j-1] > sum[j]){ temp1 = sum[j]; sum [j] = sum[j-1]; sum[j-1] = temp1; temp2 = name[j]; name[j] = name[j-1]; name[j-1] = temp2; } } } for(int i = 0;i <= 4;i++){ bw.write(name[4-i]); bw.write(" "+sum[4-i]); bw.newLine(); } bw.close(); } public static void main(String[] args) throws IOException{ Score s = new Score(); s.input(); s.compositor(); } }
SimbaLi123 2015-06-16
  • 打赏
  • 举报
回复
这个还是挺简单的啊,你网上找找swing的相关资料,做个大体的框架界面出来,然后填代码就行了
zs1003 2015-06-16
  • 打赏
  • 举报
回复
那怎么才算是呢
Inhibitory 2015-06-16
  • 打赏
  • 举报
回复
这是悉心求教吗

51,396

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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