...

View Full Version : Im dying lol - Database Prob



Predatawr
07-25-2004, 11:45 AM
hey, this forum looks really great and im frustrated that i didn't find it sooner, especially since my computer science course is coming to an end soon :(
I have a problem, i have to write a database for a soccer team that can store information on players/teams. I will include a layout, and show u the code i have done now, problem is i don't know anything about storing it all as an array/database.
-----------------------------------------------------------------------
import java.io.*;
import java.util.*;
import javax.swing.*;

public class myTeam
{

public static void main(String[]args)

{

int team, score, howMany;

String teams, scores, enterTeam, enterHowMany;


enterHowMany = JOptionPane.showInputDialog("How many teams are there?");
howMany = Integer.parseInt(enterHowMany);


String[]teamlist = new String[howMany];


int[]goals = new int[howMany];



for (int i=0; i<howMany; i++)

{

enterTeam = JOptionPane.showInputDialog("Please enter the name of the team");
teamlist[i]=enterTeam;

}



for (int i=0; i<howMany; i++)

{

System.out.println(teamlist[i]);

}


for (int i=0; i<howMany; i++ )



{

scores = JOptionPane.showInputDialog("How many goals did " + teamlist[i] + " score?");
score = Integer.parseInt(scores);
goals[i]=score;

}

System.out.println("Thankyou");
System.out.println("All scores taken");
System.out.println("---------------------");

for (int i=0; i<howMany; i++)

{

System.out.println(teamlist[i] + " scored " + goals[i] + " goals");

}


System.out.println("---------------------");


try
{

FileOutputStream teamlistOut = new FileOutputStream("C:/ladder.txt");
PrintWriter print = new PrintWriter(teamlistOut);

for (int i=0; i<howMany; i++)

{

print.println(teamlist[i] + " scored " + goals[i] + " goals");

}


print.close();

}catch (IOException e) {

System.err.println("Caught IOException: " + e.getMessage());
}

}
}

------------------------------------------------------------------
This is still complete as is, i haven't got search functions or anything added to it, nor modifying functions and so on. Im pretty noob at programming, as it was i got alot of help to even get that much (above).
I'd appreciate help greatly as this assignment is due very soon and eh, it looks like im heading nowhere :(

Predatawr
07-25-2004, 12:06 PM
I've been thinking im not going to add anything about teams, just which team they're in, and focus mainly on the goal aspect of it .. since Im really getting ahead of myself... I also don't know how to add previous scores to new - modifying as such :(

TheSeeker
07-27-2004, 06:47 PM
Do you have to use Java? MySQL will make your life much,much easier :)

Predatawr
07-28-2004, 11:33 AM
Do you have to use Java? MySQL will make your life much,much easier :)
Yea i HAVE to use java :(



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum