Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

creating basketball league

807589Dec 19 2008 — edited Jan 9 2009
I'm trying to create a game where when you type in the number it brings up a certain team. Here's how I started!




import java.io.*; //Dylan Anderson
class AtlHawks {
int Mike;
int Joe;
int Marvin;
int Al;
int Zaza;
int Josh;
int Acie;
int Maurice;
int Ronald;
int finalScoreAH;

int AHscore() {
finalScoreAH = Mike + Joe + Marvin + Al + Zaza + Josh + Acie + Maurice + Ronald;
System.out.println("Atlanta Hawks score " + finalScoreAH);
Mike = (int) (5 * Math.random()) + 15;
Joe = (int) (10 * Math.random()) + 25;
Marvin = (int) (2 * Math.random()) + 12;
Al = (int) (2 * Math.random()) + 10;
Zaza = (int) (2 * Math.random()) + 6;
Josh = (int) (5 * Math.random()) + 14;
Acie = (int) (3 * Math.random()) + 1;
Maurice = (int) (10 * Math.random()) + 1;
Ronald = (int) (13 * Math.random()) + 1;
}
return System.out.println("Atlanta Hawks score " + finalScoreAH);


}

class CharBob {
private int Raymond;
private int Jason;
private int Gerald;
private int Emeka;
private int Nazr;
private int DJ;
private int Matt;
private int Adam;
private int Sean;
private int Alexis;
private int Shannon;
int totScoreCB;


private void CBscore(){
System.out.println("Charlotte Bobcats score " + totScoreCB);
Raymond=(int) (4 * Math.random()) + 13;
Jason=(int) (5 * Math.random()) + 20;
Gerald=(int) (4 * Math.random()) + 15;
Emeka=(int) (3 * Math.random()) + 10;
Nazr=(int) (1 * Math.random()) + 2;
DJ=(int) (5 * Math.random()) + 11;
Matt=(int) (2 * Math.random()) + 3;
Adam=(int) (3 * Math.random()) + 6;
Sean=(int) (2 * Math.random()) + 2;
Alexis=(int) (1 * Math.random()) + 2;
Shannon=(int) (3 * Math.random()) + 4;
totScoreCB=Raymond + Jason + Gerald + Emeka + Nazr + DJ + Matt + Adam + Sean + Alexis + Shannon;

}
}

class NBA {
public static void main(String args[]) throws IOException {
InputStreamReader inStream=
new InputStreamReader(System.in);
BufferedReader stdin=
new BufferedReader(inStream);

String inData;
String homeTeam;
int team1;
String visitorTeam;
int team2;
String winner;

System.out.println("Enter the number:");
homeTeam = stdin.readLine();
team1 = Integer.parseint(homeTeam);
if(team1==1)
System.out.println(" " +AtlHawks.AHscore());
else(team1==0);
System.out.println(" No team entered");





}
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 6 2009
Added on Dec 19 2008
15 comments
259 views