package chap1;
import java.io.*;
public class exam1118 {
public static void main(String args[])throws Exception{
BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
String number="4020Q090",name="李依靜",pro="程設",chi="國文",eng="英文",man="管數",sta="會計";
int procredit=3,chicredit=3,engcredit=2,mancredit=3,stacredit=3;
int proscore,chiscore,engscore,manscore,stascore;
System.out.println("請輸入成績");
proscore=Integer.parseInt(br.readLine());
System.out.println("請輸入成績");
chiscore=Integer.parseInt(br.readLine());
System.out.println("請輸入成績");
engscore=Integer.parseInt(br.readLine());
System.out.println("請輸入成績");
manscore=Integer.parseInt(br.readLine());
System.out.println("請輸入成績");
stascore=Integer.parseInt(br.readLine());
int data[]={proscore,chiscore,engscore,manscore,stascore};
int sum,num;
int total;
total=(proscore*procredit+chiscore*chicredit+engscore*engcredit+manscore*mancredit+stascore*stacredit)/(procredit+chicredit+engcredit+mancredit+stacredit);
for (int s=0;s<6;s++)
System.out.println(total);
System.out.println("total= "+total);
System.out.println("學號: "+number + " 姓名: "+name);
System.out.println("科目名稱: "+pro+"\t"+chi+"\t"+eng+"\t"+man+"\t"+sta);
System.out.println("學分數: "+"\""+procredit+"\""+"\t"+"\""+chicredit+"\""+"\t"+"\""+engcredit+"\""+"\t"+"\""+mancredit+"\""+"\t"+"\""+stacredit+"\"");
System.out.println("成績: "+proscore+"\t"+chiscore+"\t"+engscore+"\t"+manscore+"\t"+stascore);
}
}
---
package practice01;
import java.io.*;
public class exam1118 {
public static void main(String args[])throws Exception{
BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
String number="4020Q090",name="李依靜",pro="程設",chi="國文",eng="英文",man="管數",sta="會計";
int procredit=3,chicredit=3,engcredit=2,mancredit=3,stacredit=3;
int proscore,chiscore,engscore,manscore,stascore;
System.out.println("請輸入成績");
proscore=Integer.parseInt(br.readLine());
System.out.println("請輸入成績");
chiscore=Integer.parseInt(br.readLine());
System.out.println("請輸入成績");
engscore=Integer.parseInt(br.readLine());
System.out.println("請輸入成績");
manscore=Integer.parseInt(br.readLine());
System.out.println("請輸入成績");
stascore=Integer.parseInt(br.readLine());
System.out.println("學號: "+number + " 姓名: "+name);
System.out.println("科目名稱: "+pro+"\t"+chi+"\t"+eng+"\t"+man+"\t"+sta);
System.out.println("學分數: "+"\""+procredit+"\""+"\t"+"\""+chicredit+"\""+"\t"+"\""+engcredit+"\""+"\t"+"\""+mancredit+"\""+"\t"+"\""+stacredit+"\"");
System.out.println("成績: "+proscore+"\t"+chiscore+"\t"+engscore+"\t"+manscore+"\t"+stascore);
int data[]={proscore,chiscore,engscore,manscore,stascore};
int total=0;
for (int i=0; i<6; i++){
total = total+i; //累加
System.out.println("total= "+total);
}
}
}