1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
package 上机练习;
public class A01class {
double Java,C,DB;
public double A(){
double total = Java + C +DB;
return total ;
}
public double B (){
double P =(Java + C +DB)/ 3 ;
return P ;
}
public void C(){
System.out.println( "总成绩:" +A());
}
public void D(){
System.out.println( "平均分:" +B());
}
} package 上机练习;
import java.util.Scanner;
public class A01 {
public static void main(String[] args) {
// TODO Auto-generated method stub
A01class A = new A01class();
Scanner in = new Scanner(System.in);
System.out.println( "请输入java成绩:" );
A.Java=in.nextInt();
System.out.println( "请输入C#成绩:" );
A.C=in.nextInt();
System.out.println( "请输入DB成绩:" );
A.DB=in.nextInt();
A.C();
A.D();
}
} |
本文转自 Y幕徐 51CTO博客,原文链接:http://blog.51cto.com/765133133/1426373