Hello World
I made a simple program on creating new objects (student1 and student2). I compiled it and it is OK, but when I run it, I don't see results. I tried to insert from Line#4 to Line#36 after Line#2 but I'm getting compile error. Please guide me.
>>>Shifting to Java now : )
[CODE=java]public class student{
public static void main(String args[]){
}
String student_id;
String lastname;
String firstname;
String address;
int score=0;
void get_student_id( String adStudentId){
student_id=adSt udentId;
}
void getlastname(Str ing adLastName){
lastname=adLast Name;
}
void getfirstname(St ring adFirstName){
firstname=adFir stName;
}
void getaddress(Stri ng adAddress){
address=adAddre ss;
}
int totalscore(int score1, int score2, int score3){
score=score1+sc ore2+score3;
return score;
}
void printoutput(){
System.out.prin tln("studentid: " + student_id);
System.out.prin tln("lastname: " + lastname);
System.out.prin tln("firstname: " + firstname);
System.out.prin tln("address: " + address);
System.out.prin tln("totalscore : " + score);
}
}
class bscs extends student{
public static void main(String args[]){
// int r=
student student1=new student();
student student2=new student();
student1.get_st udent_id("2004-01287");
student1.getlas tname("caƱeso") ;
student1.getfir stname("reysean ");
student1.getadd ress("upper calarian, zamboanga city");
student1.totals core(30, 45, 75);
student2.get_st udent_id("2005-23652");
student2.get_st udent_id("marav illa");
student2.get_st udent_id("eunic e");
student2.get_st udent_id("bonif acio, davao city");
student1.totals core(30, 45, 75);
student1.printo utput();
student2.printo utput();
}
}[/CODE]
Rey Sean
I made a simple program on creating new objects (student1 and student2). I compiled it and it is OK, but when I run it, I don't see results. I tried to insert from Line#4 to Line#36 after Line#2 but I'm getting compile error. Please guide me.
>>>Shifting to Java now : )
[CODE=java]public class student{
public static void main(String args[]){
}
String student_id;
String lastname;
String firstname;
String address;
int score=0;
void get_student_id( String adStudentId){
student_id=adSt udentId;
}
void getlastname(Str ing adLastName){
lastname=adLast Name;
}
void getfirstname(St ring adFirstName){
firstname=adFir stName;
}
void getaddress(Stri ng adAddress){
address=adAddre ss;
}
int totalscore(int score1, int score2, int score3){
score=score1+sc ore2+score3;
return score;
}
void printoutput(){
System.out.prin tln("studentid: " + student_id);
System.out.prin tln("lastname: " + lastname);
System.out.prin tln("firstname: " + firstname);
System.out.prin tln("address: " + address);
System.out.prin tln("totalscore : " + score);
}
}
class bscs extends student{
public static void main(String args[]){
// int r=
student student1=new student();
student student2=new student();
student1.get_st udent_id("2004-01287");
student1.getlas tname("caƱeso") ;
student1.getfir stname("reysean ");
student1.getadd ress("upper calarian, zamboanga city");
student1.totals core(30, 45, 75);
student2.get_st udent_id("2005-23652");
student2.get_st udent_id("marav illa");
student2.get_st udent_id("eunic e");
student2.get_st udent_id("bonif acio, davao city");
student1.totals core(30, 45, 75);
student1.printo utput();
student2.printo utput();
}
}[/CODE]
Rey Sean
Comment