katCT
12-04-2005, 06:22 PM
I wrote a program and it wont run correctly anyone know why?
class student {
private string first name, last name
private address home address, school address
private int test1, test2, test3
}
class Address {
private string streetAddress, city, state
private long zip code
public student (String first, string last, Address home, Address school,intt1,intt2, intt3){
last name=last;
fist name=first;
home address=home;
school address=school;
test1=t1;
test2=t2;
test3=t3;
}
public student (String first, string last, Address home, Address school){
last name=last;
fist name=first;
home address=home;
school address=school;
test1=0;
test2=0;
test3=0;
}
public void set Test Score (int test number, int test score)
if (number == 1) {
test 1 == test score
else (
if (test number == 2)
test 2 == test score,
else
test 3 == test score,
public intgetTestScore(int testNumber)(
if (test number == 1)
return test1
else (
if (test number == 2)
return test 2
else
return test3.)
}
public double.Average (){
returns (test1 + test2 + test3)/3.
public string to string ()
{string result
result = first name +"n"+ last name +"n"+;
result = "HomeAddressln"+ homeAddress +"n";
result = "schoolAddressln"+ schoolAdress +"n";
result = "test1" + "test 1 + "n";
result = "test2" + "test 2 + "n";
result = "test3" + "test 3 + "n";
result = "average" +this.average()+"n";
}
}
class course {
static int numberstudent = 0;
String title;
student student1;
student student2;
student student3;
student student4;
student student5;
}
public course(string course_title)(
title=course_title,
)
public void addStudent (Student newStudent)(
numStudent ++,
Switch(num Students)(
case1 student 1 = new student;
break,
case2 student 2 = new student;
break,
case3 student 3 = new student;
break,
case4 student 4 = new student;
break,
case5 student 5 = new student;
break,
default: System out.println("No More students allowed in the class");
}
}
publib string to string ()
string resultsC
results += Student 1 to sting () +"n";
results += Student 2 to sting () +"n";
results += Student 3 to sting () +"n";
results += Student 4 to sting () +"n";
results += Student 5 to sting () +"n";
return result;
}
class student {
private string first name, last name
private address home address, school address
private int test1, test2, test3
}
class Address {
private string streetAddress, city, state
private long zip code
public student (String first, string last, Address home, Address school,intt1,intt2, intt3){
last name=last;
fist name=first;
home address=home;
school address=school;
test1=t1;
test2=t2;
test3=t3;
}
public student (String first, string last, Address home, Address school){
last name=last;
fist name=first;
home address=home;
school address=school;
test1=0;
test2=0;
test3=0;
}
public void set Test Score (int test number, int test score)
if (number == 1) {
test 1 == test score
else (
if (test number == 2)
test 2 == test score,
else
test 3 == test score,
public intgetTestScore(int testNumber)(
if (test number == 1)
return test1
else (
if (test number == 2)
return test 2
else
return test3.)
}
public double.Average (){
returns (test1 + test2 + test3)/3.
public string to string ()
{string result
result = first name +"n"+ last name +"n"+;
result = "HomeAddressln"+ homeAddress +"n";
result = "schoolAddressln"+ schoolAdress +"n";
result = "test1" + "test 1 + "n";
result = "test2" + "test 2 + "n";
result = "test3" + "test 3 + "n";
result = "average" +this.average()+"n";
}
}
class course {
static int numberstudent = 0;
String title;
student student1;
student student2;
student student3;
student student4;
student student5;
}
public course(string course_title)(
title=course_title,
)
public void addStudent (Student newStudent)(
numStudent ++,
Switch(num Students)(
case1 student 1 = new student;
break,
case2 student 2 = new student;
break,
case3 student 3 = new student;
break,
case4 student 4 = new student;
break,
case5 student 5 = new student;
break,
default: System out.println("No More students allowed in the class");
}
}
publib string to string ()
string resultsC
results += Student 1 to sting () +"n";
results += Student 2 to sting () +"n";
results += Student 3 to sting () +"n";
results += Student 4 to sting () +"n";
results += Student 5 to sting () +"n";
return result;
}