Thursday, March 6, 2014

This program can not run in the android studio;


 

package jj;

class Struct {
int age;
String name;
int maths;
int English;
int Chinese;

double tal (int c, int m, int e) {
this.Chinese = c;
this.maths = m;
this.English = e;
return c + m + e;
}
double average (int c, int m, int e) {
one of three usage this.Chinese = c ;/ / / this is ------ 1 class member variables referenced instead of function parameters;
this.maths = m;
this.English = e;
return (c + m + e) ​​/ 3.0d ;/ /

}

}

public class lll {
public static void main (String [] args) {
int s = 93, t = 78, z = 84 ;/ / when you need to use the variables given initial java;

Struct a;
a = new Struct ();
a.age = 23;
a.name = "Joe Smith";
a.Chinese = 93;
a.English = 78;
a.maths = 84;
a.average (s, t, z);
a.tal (s, t, z);


System.out.println ("Name:" + a.name + "Age:" + a.age);
System.out.println ("");

System.out.println ("three courses for a total score =" + a.tal (s, t, z));
System.out.println ("grade point average of three lessons =" ​​+ a.average (s, t, z));



}
}
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:

No comments:

Post a Comment