- package site.istak.org.tw;
- import java.util.Scanner;
- public class Main {
-
- public static void main(String[] args){
-
- Scanner scanner=new Scanner(System.in);
- int[]frank =new int[3];
- int[]eric =new int[3];
- int[]terry =new int[3];
- for(int i=0;i<frank.length;i++){
- frank[i]=scanner.nextInt();
- }
- for(int i=0;i<eric.length;i++){
- eric[i]=scanner.nextInt();
- }
- for(int i=0;i<terry.length;i++){
- terry[i]=scanner.nextInt();
- }
- Studens studens=new Studens();
- Studens.Avg(frank[0],frank[1],frank[2]);
- Studens.Avg(eric[0],eric[1],eric[2]);
- Studens.Avg(terry[0],terry[1],terry[2]);
- }
-
-
- }
複製代碼- package site.istak.org.tw;
- public class Studens {
- private float c;
- private float e;
- private float m;
- private float total;
- public Studens(){
- this.c = c;
- this.e = e;
- this.m = m;
- this.total=total;
- }
- public static void Avg(int c,int e,int m){
- int total=c+e+m;
- System.out.println(total/3);
-
- }
- }
複製代碼 |