Hello everyone,
I'm a new programmer and thus still suck, I do not even know if I should be posting this here or be able to receive any help.
However, my issue is the following: (Note: I'm using Ready to Program to code)
I've wrote a gaming database and I'm calling them using the following rs statement:
if (eve.getSource () == mybtn)
{
try
{
String sql = "Select * from Games Order by Genre";
int cnt = 0;
rs = stmt.executeQuery (sql);
while (rs.next ())
{
String Genre = rs.getString ("Genre");
String Popularity = rs.getString ("Popularity");
String HighestScore = rs.getString ("HighestScore"); // I would like to modify this value
String Rating = rs.getString ("Rating");
String PlayerName = rs.getString ("PlayerName");
String TournamentAvailable = rs.getString ("TournamentAvailable");
String Game = rs.getString ("Game");
data [cnt] [0] = Genre;
data [cnt] [1] = Popularity;
data [cnt] [2] = HighestScore; // I would like to modify this value
data [cnt] [3] = Rating;
data [cnt] [4] = PlayerName;
data [cnt] [5] = TournamentAvailable;
data [cnt] [6] = Game;
cnt++;
table.updateUI ();
}
}
catch (Exception e)
{
System.out.println ("Vraag 1 onsuksesvol");
e.printStackTrace ();
}
}
Question:
I would like to modify the value of HighestScore by replacing it with a random generated number, using the following code: double y = (Math.random () * 5001) + 1; (which generates random numbers between 1-5000)
Then, I need to take the random generated value and import it back into my JTabel.
Could anyone assist me?
Thanks in advance
Shanse
I'm a new programmer and thus still suck, I do not even know if I should be posting this here or be able to receive any help.
However, my issue is the following: (Note: I'm using Ready to Program to code)
I've wrote a gaming database and I'm calling them using the following rs statement:
if (eve.getSource () == mybtn)
{
try
{
String sql = "Select * from Games Order by Genre";
int cnt = 0;
rs = stmt.executeQuery (sql);
while (rs.next ())
{
String Genre = rs.getString ("Genre");
String Popularity = rs.getString ("Popularity");
String HighestScore = rs.getString ("HighestScore"); // I would like to modify this value
String Rating = rs.getString ("Rating");
String PlayerName = rs.getString ("PlayerName");
String TournamentAvailable = rs.getString ("TournamentAvailable");
String Game = rs.getString ("Game");
data [cnt] [0] = Genre;
data [cnt] [1] = Popularity;
data [cnt] [2] = HighestScore; // I would like to modify this value
data [cnt] [3] = Rating;
data [cnt] [4] = PlayerName;
data [cnt] [5] = TournamentAvailable;
data [cnt] [6] = Game;
cnt++;
table.updateUI ();
}
}
catch (Exception e)
{
System.out.println ("Vraag 1 onsuksesvol");
e.printStackTrace ();
}
}
Question:
I would like to modify the value of HighestScore by replacing it with a random generated number, using the following code: double y = (Math.random () * 5001) + 1; (which generates random numbers between 1-5000)
Then, I need to take the random generated value and import it back into my JTabel.
Could anyone assist me?
Thanks in advance
Shanse
Last edited: