Hi everyone :D only being learning java for the past few months and my first semester went well so even though im on holidays for xmas im playing around with some code as we are going to be moving onto oo next semester.
Im trying to make a little program that returns the form of soccer teams.My problem is a little hard for me to explain as i am not used to the oo terms yet but I will do my best.
In my class i have a method that i want to call on form the main.The data i want passed in is also done in the class and not when called but i dont seem to be allowed to do this.hopefully the code will make more sense of this.
here is the mainCode:class TeamForm {
int hform8 = 0; //last 8 home games points
int aform8 = 0; //last 8 away game points
int yform = 0; // overall year points
TeamForm(int homepoints,int awaypoints,int yearpoints ){
hform8 = homepoints;
aform8 = awaypoints;
yform =yearpoints;
}
void hreview (int hform8){
int x = hform8;
if ((x>=18)&&(x<25)){
System.out.println("Team form is above average ");
}
else if ((x>=12)&&(x<18)){
System.out.println("Team form is average");
}
else if (x<12){
System.out.println("Team form is poor");
}
void display(){
System.out.println(hform8 );
System.out.println(aform8 );
System.out.println(yform );
}
}
since i have set the variables when i created team1 should i be able to call hreview as is ? it works when i pass in an int when calling hreview but this seems to defeat the purpose of creating team1.Code:public class apptest {
public static void main(String [] args){
TeamForm team1 = new TeamForm(17,13,19);
team1.hreview ();
team1.display();
}
}
Im not sure whats going on really sorry im only a beginner so if this question silly please excuse me.any help would be appreciated .thanks :)

