semi-colon error that i cant solve....
I AM GETTING A "; expected" ERROR, AT THE
"int calcpriority(timearv) { " LINE. AND THE "int AgeFac()" LINE
^ ^
I AM ASSUMING IT HAS SOMETHING TO DO WITH HOW I CREATED THESE TWO METHODS. (there are two arrows in the error message that point to the 1st bracket of each method)
PLEASE HELP.
import java.lang.String;
class Patient {
int id;
int age;
int agefactor;
int tl;
String name;
int priority;
int timearv;
int timenow;
//constructor
public Patient(int d, String n, int a, int s, int x) {
id = d;
age = a;
tl = s;
name = n;
timearv = x;
timenow = timenow + 2;
//formula to calculate priority
int calcpriority(timenow){
int priority;
priority = tl + (timenow - timearv) + AgeFac();
}
}//constructor
public String toString() {
String q = "Patient ID:"+id + "\t" + "Age:"+age + "\t" + "Trauma Level:"+tl + "\t" + "Name:"+name + "\t" + "Arrival Time:"+timearv + "\nCurrent Time:"+timenow + "Priority:"+priority;
return q;
}// of toString
public static void main(String[] args){
Patient x = new Patient(1,26,5,"malcolm",1);
int AgeFac()
int agefactor
{
if (age > 55){
agefactor = 2;
}//if
else if (age < 12){
agefactor = 2;
}//else if
else{
agefactor = 1;
}//else
}//agefactor
System.out.println(x);
}//main
}//patient class
[1538 byte] By [
malslaa] at [2007-10-2 10:48:20]

ok thanks for that, so i've rearranged the code and now i get the following error messages...."missing return statement"
}//AgeFac
and "missing return statement"
} (this one comes after the declaration of the calcpriority method...
import java.lang.String;
class Patient {
int id;
int age;
int agefactor;
int tl;
String name;
int priority;
int timearv;
int timenow;
int p;
int af;
int AgeFac(){
if (age > 55){
af = 2;
}//if
else if (age < 12){
af = 2;
}//else if
else{
af = 1;
}//else
agefactor = af;
}//AgeFac
//formula to calculate priority
int calcpriority(int timenow){
p = tl + (timenow - timearv) + 2;
}
//patient constructor
public Patient(int d, String n, int a, int s, int x) {
id = d;
age = a;
tl = s;
name = n;
timearv = x;
timenow = timenow + 2;
priority = calcpriority(timenow);
}//constructor
public String toString() {
String q = "Patient ID:"+id + "\t" + "Age:"+age + "\t" + "Trauma Level:"+tl + "\t" + "Name:"+name + "\t" + "Arrival Time:"+timearv + "\nCurrent Time:"+timenow + "Priority:"+priority;
return q;
}// of toString
public static void main(String[] args){
Patient x = new Patient(1,"malcolm",26,4,1);
System.out.println(x);
//System.out.println(GetAgeFac);
}//main
}//patient class
Please use the code tags when pasting code. There's a button labeled "code" when you post a message. Click on it and stick your code between the tags.
When you declare a method like int AgeFac(){
you are telling the compiler that the AgeFac method returns an int. You MUST have a line that returns and int. For example return af;
Also, Java coding conventions say that a method name should start with a lower case letter - ageFac instead of AgeFac. It will work either way, but you will find it easier to get help if you follow convention.