You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2449 lines
63 KiB

package de.hs_fulda.ciip.projjpn;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class Games {
private String databaseURL = "jdbc:ucanaccess://GamesDB.accdb";
/**
* Checks if the connection to the database can be established
*
* @return Returns true if it connects successfully and false if the connection
* fails.
*/
public boolean checkConnection() {
try {
Connection connection = DriverManager.getConnection(databaseURL);
connection.close();
return true;
} catch (SQLException e) {
return false;
}
}
/**
* Prints the whole table for those, who cannot access the Database for some
* reason.
*
* @return Returns a String of the whole table.
*/
public String printTable() {
String result = "";
String query = "SELECT * FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
result += "Name, Console, Developer, Publisher EU, Publisher JP, Publisher NA, Genre, Release EU, Release JP, Release NA, Release AU, USK Rating, PEGI Rating, ESRB Rating, CERO Rating, ACB Rating, Players\n\n";
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameConsole = resultSet.getString("Game_Console");
String gameDeveloper = resultSet.getString("Game_Developer");
String gamePublisherEu = resultSet.getString("Game_Publisher_EU");
String gamePublisherJp = resultSet.getString("Game_Publisher_JP");
String gamePublisherNa = resultSet.getString("Game_Publisher_NA");
String gameGenre = resultSet.getString("Game_Genre");
String gameReleaseEu = resultSet.getString("Game_Release_EU");
String gameReleaseEuDots = gameReleaseEu.substring(8, 10) + "." + gameReleaseEu.substring(5, 7) + "."
+ gameReleaseEu.substring(0, 4);
String gameReleaseJp = resultSet.getString("Game_Release_JP");
String gameReleaseJpDots = gameReleaseJp.substring(8, 10) + "." + gameReleaseJp.substring(5, 7) + "."
+ gameReleaseJp.substring(0, 4);
String gameReleaseNa = resultSet.getString("Game_Release_NA");
String gameReleaseNaDots = gameReleaseNa.substring(8, 10) + "." + gameReleaseNa.substring(5, 7) + "."
+ gameReleaseNa.substring(0, 4);
String gameReleaseAu = resultSet.getString("Game_Release_AU");
String gameReleaseAuDots;
if (gameReleaseAu != null) {
gameReleaseAuDots = gameReleaseAu.substring(8, 10) + "." + gameReleaseAu.substring(5, 7) + "."
+ gameReleaseAu.substring(0, 4);
} else {
gameReleaseAuDots = "Unknown";
}
int gameUsk = resultSet.getInt("Game_USK_Rating");
int gamePegi = resultSet.getInt("Game_PEGI_Rating");
String gameEsrb = resultSet.getString("Game_ESRB_Rating");
String gameCero = resultSet.getString("Game_CERO_Rating");
String gameAcb = resultSet.getString("Game_ACB_Rating");
String gamePlayers = resultSet.getString("Game_Players");
if (gamePegi != 0) {
result += gameName + ", " + gameConsole + ", " + gameDeveloper + ", " + gamePublisherEu + ", "
+ gamePublisherJp + ", " + gamePublisherNa + ", " + gameGenre + ", " + gameReleaseEuDots
+ ", " + gameReleaseJpDots + ", " + gameReleaseNaDots + ", " + gameReleaseAuDots + ", "
+ gameUsk + ", " + gamePegi + ", " + gameEsrb + ", " + gameCero + ", " + gameAcb + ", "
+ gamePlayers + "\n";
} else {
result += gameName + ", " + gameConsole + ", " + gameDeveloper + ", " + gamePublisherEu + ", "
+ gamePublisherJp + ", " + gamePublisherNa + ", " + gameGenre + ", " + gameReleaseEuDots
+ ", " + gameReleaseJpDots + ", " + gameReleaseNaDots + ", " + gameReleaseAuDots + ", "
+ gameUsk + ", Unknown, " + gameEsrb + ", " + gameCero + ", " + gameAcb + ", " + gamePlayers
+ "\n";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
// The substring removes the last New line in the String.
return result.substring(0, result.length() - 1);
}
/**
* Prints out all game names from the table.
*
* @return Returns a String with the game names
*/
public String checkGames() {
String result = "";
String query = "SELECT Game_Name FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
result += gameName + ", ";
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Prints out all of the consoles which are represented in the table.
*
* @return Returns a String with the consoles.
*/
public String checkConsoles() {
String result = "";
String query = "SELECT Game_Console FROM Games";
boolean ninSwitch = false;
boolean xbox = false;
boolean multiplat = false;
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameConsole = resultSet.getString("Game_Console");
if (ninSwitch && gameConsole.equals("Nintendo Switch")) {
continue;
} else if (xbox && gameConsole.equals("Xbox")) {
continue;
} else if (multiplat && gameConsole.equals("Multiplatform")) {
continue;
}
switch (gameConsole) {
case "Nintendo Switch":
ninSwitch = true;
break;
case "Xbox":
xbox = true;
break;
case "Multiplatform":
multiplat = true;
break;
}
result += gameConsole + ", ";
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game has the same publishers across Europe, Japan and North
* America
*
* @return Prints the games, that have the same publishers.
*/
public String checkAllSamePublishers() {
String result = "";
String query = "SELECT Game_Name, Game_Publisher_EU, Game_Publisher_JP, Game_Publisher_NA FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gamePublisherEu = resultSet.getString("Game_Publisher_EU");
String gamePublisherJp = resultSet.getString("Game_Publisher_JP");
String gamePublisherNa = resultSet.getString("Game_Publisher_NA");
if (gamePublisherEu.equals(gamePublisherJp) && gamePublisherJp.equals(gamePublisherNa)
&& gamePublisherEu.equals(gamePublisherNa)) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game has not the same publishers across Europe, Japan and North
* America
*
* @return Prints the games, that do not have the same publishers.
*/
public String checkAllDifferentPublishers() {
String result = "";
String query = "SELECT Game_Name, Game_Publisher_EU, Game_Publisher_JP, Game_Publisher_NA FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gamePublisherEu = resultSet.getString("Game_Publisher_EU");
String gamePublisherJp = resultSet.getString("Game_Publisher_JP");
String gamePublisherNa = resultSet.getString("Game_Publisher_NA");
if (!gamePublisherEu.equals(gamePublisherJp) && !gamePublisherJp.equals(gamePublisherNa)
&& !gamePublisherEu.equals(gamePublisherNa)) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the developers and the publishers are all the same.
*
* @return Prints the games, where publishers and developers are the same.
*/
public String checkAllDifferentPublishersDeveloper() {
String result = "";
String query = "SELECT Game_Name, Game_Developer, Game_Publisher_EU, Game_Publisher_JP, Game_Publisher_NA FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameDeveloper = resultSet.getString("Game_Developer");
String gamePublisherEu = resultSet.getString("Game_Publisher_EU");
String gamePublisherJp = resultSet.getString("Game_Publisher_JP");
String gamePublisherNa = resultSet.getString("Game_Publisher_NA");
if (gamePublisherEu.equals(gamePublisherJp) && gamePublisherJp.equals(gamePublisherNa)
&& gamePublisherEu.equals(gamePublisherNa) && gameDeveloper.equals(gamePublisherEu)
&& gameDeveloper.equals(gamePublisherJp) && gameDeveloper.equals(gamePublisherNa)) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the release dates are all the same across Europe, Japan, North
* America and Australia.
*
* @return Prints the games which have the same release dates.
*/
public String checkAllSameReleaseDates() {
String result = "";
String query = "SELECT Game_Name, Game_Release_EU, Game_Release_JP, Game_Release_NA, Game_Release_AU FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameReleaseEu = resultSet.getString("Game_Release_EU");
String gameReleaseJp = resultSet.getString("Game_Release_JP");
String gameReleaseNa = resultSet.getString("Game_Release_NA");
String gameReleaseAu = resultSet.getString("Game_Release_AU");
if (gameReleaseAu == null) {
if (gameReleaseEu.equals(gameReleaseJp) && gameReleaseJp.equals(gameReleaseNa)
&& gameReleaseEu.equals(gameReleaseNa)) {
result += gameName + ", ";
}
} else {
if (gameReleaseEu.equals(gameReleaseJp) && gameReleaseJp.equals(gameReleaseNa)
&& gameReleaseEu.equals(gameReleaseNa) && gameReleaseAu.equals(gameReleaseEu)
&& gameReleaseAu.equals(gameReleaseJp) && gameReleaseAu.equals(gameReleaseNa)) {
result += gameName + ", ";
}
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the release dates are not all the same across Europe, Japan, North
* America and Australia.
*
* @return Prints the games which do not have the same release dates.
*/
public String checkAllDifferentReleaseDates() {
String result = "";
String query = "SELECT Game_Name, Game_Release_EU, Game_Release_JP, Game_Release_NA, Game_Release_AU FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameReleaseEu = resultSet.getString("Game_Release_EU");
String gameReleaseJp = resultSet.getString("Game_Release_JP");
String gameReleaseNa = resultSet.getString("Game_Release_NA");
String gameReleaseAu = resultSet.getString("Game_Release_AU");
if (gameReleaseAu == null) {
if (!gameReleaseEu.equals(gameReleaseJp) && !gameReleaseJp.equals(gameReleaseNa)
&& !gameReleaseEu.equals(gameReleaseNa)) {
result += gameName + ", ";
}
} else {
if (!gameReleaseEu.equals(gameReleaseJp) && !gameReleaseJp.equals(gameReleaseNa)
&& !gameReleaseEu.equals(gameReleaseNa) && !gameReleaseAu.equals(gameReleaseEu)
&& !gameReleaseAu.equals(gameReleaseJp) && !gameReleaseAu.equals(gameReleaseNa)) {
result += gameName + ", ";
}
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks the game genres that are available in the table
*
* @return Prints all the available game genres from the table.
*/
public String checkGameGenres() {
String result = "";
String query = "SELECT Game_Genre FROM Games";
boolean actAd = false;
boolean rpg = false;
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameGenre = resultSet.getString("Game_Genre");
if (actAd && gameGenre.equals("Action-Adventure")) {
continue;
} else if (rpg && gameGenre.equals("RPG")) {
continue;
}
switch (gameGenre) {
case "Action-Adventure":
actAd = true;
break;
case "RPG":
rpg = true;
break;
}
result += gameGenre + ", ";
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the games genre is Action-Adventure
*
* @return Prints all the Action-Adventure games.
*/
public String checkGameGenreActionAdventure() {
String result = "";
String query = "SELECT Game_Name, Game_Genre FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameGenre = resultSet.getString("Game_Genre");
if (gameGenre.equals("Action-Adventure")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the games genre is RPG
*
* @return Prints all the RPG games.
*/
public String checkGameGenreRPG() {
String result = "";
String query = "SELECT Game_Name, Game_Genre FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameGenre = resultSet.getString("Game_Genre");
if (gameGenre.equals("RPG")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Prints out all of the games which are on a PlayStation console.
*
* @return Returns a String with the games from a PlayStation console.
*/
public String checkConsolePlayStation() {
String result = "";
String query = "SELECT Game_Name, Game_Console FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameConsole = resultSet.getString("Game_Console");
if (gameConsole.length() >= 11) {
if (gameConsole.substring(0, 11).equals("PlayStation")) {
result += gameName + ", ";
}
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Prints out all of the games which are on a Nintendo console.
*
* @return Returns a String with the games from a Nintendo console.
*/
public String checkConsoleNintendo() {
String result = "";
String query = "SELECT Game_Name, Game_Console FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameConsole = resultSet.getString("Game_Console");
if (gameConsole.length() >= 8) {
if (gameConsole.substring(0, 8).equals("Nintendo")) {
result += gameName + ", ";
}
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Prints out all of the games which are on a Xbox console.
*
* @return Returns a String with the games from a Xbox console.
*/
public String checkConsoleXbox() {
String result = "";
String query = "SELECT Game_Name, Game_Console FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameConsole = resultSet.getString("Game_Console");
if (gameConsole.length() >= 4) {
if (gameConsole.substring(0, 4).equals("Xbox")) {
result += gameName + ", ";
}
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Prints out all of the games which are multiplatform.
*
* @return Returns a String with the multiplatform games .
*/
public String checkConsoleMultiplatform() {
String result = "";
String query = "SELECT Game_Name, Game_Console FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameConsole = resultSet.getString("Game_Console");
if (gameConsole.length() >= 13) {
if (gameConsole.substring(0, 13).equals("Multiplatform")) {
result += gameName + ", ";
}
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Prints out all of the games which are on a Nintendo Switch.
*
* @return Returns a String with the games from a Nintendo Switch.
*/
public String checkConsoleNintendoSwitch() {
String result = "";
String query = "SELECT Game_Name, Game_Console FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameConsole = resultSet.getString("Game_Console");
if (gameConsole.equals("Nintendo Switch")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the developer of the game is Atlus.
*
* @return Prints the games developed by Atlus.
*/
public String checkDeveloperAtlus() {
String result = "";
String query = "SELECT Game_Name, Game_Developer FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameDeveloper = resultSet.getString("Game_Developer");
if (gameDeveloper.equals("Atlus")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks the developers that are available in the table.
*
* @return Prints the developers from the table.
*/
public String checkDevelopers() {
String result = "";
String query = "SELECT Game_Developer FROM Games";
boolean atlus = false;
boolean nintendoSpd = false;
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameDeveloper = resultSet.getString("Game_Developer");
if (atlus && gameDeveloper.equals("Atlus")) {
continue;
} else if (nintendoSpd && gameDeveloper.equals("Nintendo SPD")) {
continue;
}
switch (gameDeveloper) {
case "Atlus":
atlus = true;
break;
case "Nintendo SPD":
nintendoSpd = true;
break;
}
result += gameDeveloper + ", ";
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game has the publisher Nintendo across Europe, Japan and North
* America
*
* @return Prints the games, that have Nintendo as a publisher.
*/
public String checkPublisherNintendo() {
String result = "";
String query = "SELECT Game_Name, Game_Publisher_EU, Game_Publisher_JP, Game_Publisher_NA FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gamePublisherEu = resultSet.getString("Game_Publisher_EU");
String gamePublisherJp = resultSet.getString("Game_Publisher_JP");
String gamePublisherNa = resultSet.getString("Game_Publisher_NA");
if (gamePublisherEu.equals("Nintendo") || gamePublisherJp.equals("Nintendo")
|| gamePublisherNa.equals("Nintendo")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game has the publisher Sega across Europe, Japan and North
* America
*
* @return Prints the games, that have Sega as a publisher.
*/
public String checkPublisherSega() {
String result = "";
String query = "SELECT Game_Name, Game_Publisher_EU, Game_Publisher_JP, Game_Publisher_NA FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gamePublisherEu = resultSet.getString("Game_Publisher_EU");
String gamePublisherJp = resultSet.getString("Game_Publisher_JP");
String gamePublisherNa = resultSet.getString("Game_Publisher_NA");
if (gamePublisherEu.equals("Sega") || gamePublisherJp.equals("Sega")
|| gamePublisherNa.equals("Sega")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks the publishers that are available in the table across Europe, Japan
* and North America
*
* @return Prints the publishers from Europe, Japan and North America.
*/
public String checkPublishers() {
String result = "";
String query = "SELECT Game_Publisher_EU, Game_Publisher_JP, Game_Publisher_NA FROM Games";
boolean sega = false;
boolean atlus = false;
boolean sce = false;
boolean nintendo = false;
boolean namco = false;
boolean spikeChun = false;
boolean bandaiNamco = false;
boolean activision = false;
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gamePublisherEu = resultSet.getString("Game_Publisher_EU");
String gamePublisherJp = resultSet.getString("Game_Publisher_JP");
String gamePublisherNa = resultSet.getString("Game_Publisher_NA");
while (true) {
while (true) {
if (sega && gamePublisherEu.equals("Sega")) {
break;
} else if (atlus && gamePublisherEu.equals("Atlus")) {
break;
} else if (sce && gamePublisherEu.equals("Sony Computer Entertainment")) {
break;
} else if (nintendo && gamePublisherEu.equals("Nintendo")) {
break;
} else if (namco && gamePublisherEu.equals("Namco")) {
break;
} else if (spikeChun && gamePublisherEu.equals("Spike Chunsoft")) {
break;
} else if (bandaiNamco && gamePublisherEu.equals("Bandai Namco Games")) {
break;
} else if (activision && gamePublisherEu.equals("Activision")) {
break;
}
switch (gamePublisherEu) {
case "Sega":
sega = true;
break;
case "Atlus":
atlus = true;
break;
case "Sony Computer Entertainment":
sce = true;
break;
case "Nintendo":
nintendo = true;
break;
case "Namco":
namco = true;
break;
case "Spike Chunsoft":
spikeChun = true;
break;
case "Bandai Namco Games":
bandaiNamco = true;
break;
case "Activision":
activision = true;
break;
}
result += gamePublisherEu + ", ";
break;
}
if (sega && gamePublisherJp.equals("Sega")) {
break;
} else if (atlus && gamePublisherJp.equals("Atlus")) {
break;
} else if (sce && gamePublisherJp.equals("Sony Computer Entertainment")) {
break;
} else if (nintendo && gamePublisherJp.equals("Nintendo")) {
break;
} else if (namco && gamePublisherJp.equals("Namco")) {
break;
} else if (spikeChun && gamePublisherJp.equals("Spike Chunsoft")) {
break;
} else if (bandaiNamco && gamePublisherJp.equals("Bandai Namco Games")) {
break;
} else if (activision && gamePublisherJp.equals("Activision")) {
break;
}
switch (gamePublisherJp) {
case "Sega":
sega = true;
break;
case "Atlus":
atlus = true;
break;
case "Sony Computer Entertainment":
sce = true;
break;
case "Nintendo":
nintendo = true;
break;
case "Namco":
namco = true;
break;
case "Spike Chunsoft":
spikeChun = true;
break;
case "Bandai Namco Games":
bandaiNamco = true;
break;
case "Activision":
activision = true;
break;
}
result += gamePublisherJp + ", ";
break;
}
if (sega && gamePublisherNa.equals("Sega")) {
continue;
} else if (atlus && gamePublisherNa.equals("Atlus")) {
continue;
} else if (sce && gamePublisherNa.equals("Sony Computer Entertainment")) {
continue;
} else if (nintendo && gamePublisherNa.equals("Nintendo")) {
continue;
} else if (namco && gamePublisherNa.equals("Namco")) {
continue;
} else if (spikeChun && gamePublisherNa.equals("Spike Chunsoft")) {
continue;
} else if (bandaiNamco && gamePublisherNa.equals("Bandai Namco Games")) {
continue;
} else if (activision && gamePublisherNa.equals("Activision")) {
continue;
}
switch (gamePublisherNa) {
case "Sega":
sega = true;
break;
case "Atlus":
atlus = true;
break;
case "Sony Computer Entertainment":
sce = true;
break;
case "Nintendo":
nintendo = true;
break;
case "Namco":
namco = true;
break;
case "Spike Chunsoft":
spikeChun = true;
break;
case "Bandai Namco Games":
bandaiNamco = true;
break;
case "Activision":
activision = true;
break;
}
result += gamePublisherNa + ", ";
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks the publishers that are available in the table across Europe
*
* @return Prints the publishers from Europe.
*/
public String checkPublishersEu() {
String result = "";
String query = "SELECT Game_Publisher_EU FROM Games";
boolean sega = false;
boolean nintendo = false;
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gamePublisherEu = resultSet.getString("Game_Publisher_EU");
if (sega && gamePublisherEu.equals("Sega")) {
continue;
} else if (nintendo && gamePublisherEu.equals("Nintendo")) {
continue;
}
switch (gamePublisherEu) {
case "Sega":
sega = true;
break;
case "Nintendo":
nintendo = true;
break;
}
result += gamePublisherEu + ", ";
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks the publishers that are available in the table across Japan
*
* @return Prints the publishers from Japan.
*/
public String checkPublishersJp() {
String result = "";
String query = "SELECT Game_Publisher_JP FROM Games";
boolean atlus = false;
boolean nintendo = false;
boolean sega = false;
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gamePublisherJp = resultSet.getString("Game_Publisher_JP");
if (atlus && gamePublisherJp.equals("Atlus")) {
continue;
} else if (nintendo && gamePublisherJp.equals("Nintendo")) {
continue;
} else if (sega && gamePublisherJp.equals("Sega")) {
continue;
}
switch (gamePublisherJp) {
case "Atlus":
atlus = true;
break;
case "Nintendo":
nintendo = true;
break;
case "Sega":
sega = true;
break;
}
result += gamePublisherJp + ", ";
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks the publishers that are available in the table across North America
*
* @return Prints the publishers from North America.
*/
public String checkPublishersNa() {
String result = "";
String query = "SELECT Game_Publisher_NA FROM Games";
boolean atlus = false;
boolean nintendo = false;
boolean sega = false;
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gamePublisherNa = resultSet.getString("Game_Publisher_Na");
if (atlus && gamePublisherNa.equals("Atlus")) {
continue;
} else if (nintendo && gamePublisherNa.equals("Nintendo")) {
continue;
} else if (sega && gamePublisherNa.equals("Sega")) {
continue;
}
switch (gamePublisherNa) {
case "Atlus":
atlus = true;
break;
case "Nintendo":
nintendo = true;
break;
case "Sega":
sega = true;
break;
}
result += gamePublisherNa + ", ";
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks the release dates that are unknown.
*
* @return Prints the games which do not have a release date.
*/
public String checkReleaseDateUnknown() {
String result = "";
String query = "SELECT Game_Name, Game_Release_AU FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameReleaseAu = resultSet.getString("Game_Release_AU");
if (gameReleaseAu == null) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the release years are all the same across Europe, Japan, North
* America and Australia.
*
* @return Prints the games which have the same release year.
*/
public String checkAllSameReleaseYear() {
String result = "";
String query = "SELECT Game_Name, Game_Release_EU, Game_Release_JP, Game_Release_NA, Game_Release_AU FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameReleaseEu = resultSet.getString("Game_Release_EU");
String gameReleaseJp = resultSet.getString("Game_Release_JP");
String gameReleaseNa = resultSet.getString("Game_Release_NA");
String gameReleaseAu = resultSet.getString("Game_Release_AU");
if (gameReleaseAu == null) {
} else {
if (gameReleaseEu.substring(0, 4).equals(gameReleaseJp.substring(0, 4))
&& gameReleaseJp.substring(0, 4).equals(gameReleaseNa.substring(0, 4))
&& gameReleaseEu.substring(0, 4).equals(gameReleaseNa.substring(0, 4))
&& gameReleaseAu.substring(0, 4).equals(gameReleaseEu.substring(0, 4))
&& gameReleaseAu.substring(0, 4).equals(gameReleaseJp.substring(0, 4))
&& gameReleaseAu.substring(0, 4).equals(gameReleaseNa.substring(0, 4))) {
result += gameName + ", ";
}
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the release year are not all the same across Europe, Japan, North
* America and Australia.
*
* @return Prints the games which do not have the same release year.
*/
public String checkAllDifferentReleaseYear() {
String result = "";
String query = "SELECT Game_Name, Game_Release_EU, Game_Release_JP, Game_Release_NA, Game_Release_AU FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameReleaseEu = resultSet.getString("Game_Release_EU");
String gameReleaseJp = resultSet.getString("Game_Release_JP");
String gameReleaseNa = resultSet.getString("Game_Release_NA");
String gameReleaseAu = resultSet.getString("Game_Release_AU");
if (gameReleaseAu == null) {
result += gameName + ", ";
} else {
if (!gameReleaseEu.substring(0, 4).equals(gameReleaseJp.substring(0, 4))
|| !gameReleaseJp.substring(0, 4).equals(gameReleaseNa.substring(0, 4))
|| !gameReleaseEu.substring(0, 4).equals(gameReleaseNa.substring(0, 4))
|| !gameReleaseAu.substring(0, 4).equals(gameReleaseEu.substring(0, 4))
|| !gameReleaseAu.substring(0, 4).equals(gameReleaseJp.substring(0, 4))
|| !gameReleaseAu.substring(0, 4).equals(gameReleaseNa.substring(0, 4))) {
result += gameName + ", ";
}
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the release months are all the same across Europe, Japan, North
* America and Australia.
*
* @return Prints the games which have the same release month.
*/
public String checkAllSameReleaseMonth() {
String result = "";
String query = "SELECT Game_Name, Game_Release_EU, Game_Release_JP, Game_Release_NA, Game_Release_AU FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameReleaseEu = resultSet.getString("Game_Release_EU");
String gameReleaseJp = resultSet.getString("Game_Release_JP");
String gameReleaseNa = resultSet.getString("Game_Release_NA");
String gameReleaseAu = resultSet.getString("Game_Release_AU");
if (gameReleaseAu == null) {
} else {
if (gameReleaseEu.substring(5, 7).equals(gameReleaseJp.substring(5, 7))
&& gameReleaseJp.substring(5, 7).equals(gameReleaseNa.substring(5, 7))
&& gameReleaseEu.substring(5, 7).equals(gameReleaseNa.substring(5, 7))
&& gameReleaseAu.substring(5, 7).equals(gameReleaseEu.substring(5, 7))
&& gameReleaseAu.substring(5, 7).equals(gameReleaseJp.substring(5, 7))
&& gameReleaseAu.substring(5, 7).equals(gameReleaseNa.substring(5, 7))) {
result += gameName + ", ";
}
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the release months are not all the same across Europe, Japan, North
* America and Australia.
*
* @return Prints the games which do not have the same release month.
*/
public String checkAllDifferentReleaseMonth() {
String result = "";
String query = "SELECT Game_Name, Game_Release_EU, Game_Release_JP, Game_Release_NA, Game_Release_AU FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameReleaseEu = resultSet.getString("Game_Release_EU");
String gameReleaseJp = resultSet.getString("Game_Release_JP");
String gameReleaseNa = resultSet.getString("Game_Release_NA");
String gameReleaseAu = resultSet.getString("Game_Release_AU");
if (gameReleaseAu == null) {
result += gameName + ", ";
} else {
if (!gameReleaseEu.substring(5, 7).equals(gameReleaseJp.substring(5, 7))
|| !gameReleaseJp.substring(5, 7).equals(gameReleaseNa.substring(5, 7))
|| !gameReleaseEu.substring(5, 7).equals(gameReleaseNa.substring(5, 7))
|| !gameReleaseAu.substring(5, 7).equals(gameReleaseEu.substring(5, 7))
|| !gameReleaseAu.substring(5, 7).equals(gameReleaseJp.substring(5, 7))
|| !gameReleaseAu.substring(5, 7).equals(gameReleaseNa.substring(5, 7))) {
result += gameName + ", ";
}
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is compatible with one player or more.
*
* @return Prints out the games that can be played with one or more players.
*/
public String checkOnePlayer() {
String result = "";
String query = "SELECT Game_Name, Game_Players FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gamePlayers = resultSet.getString("Game_Players");
if (gamePlayers.equals("1") || gamePlayers.equals("1-2") || gamePlayers.equals("1-4")
|| gamePlayers.equals("1-8")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is compatible with two players or more.
*
* @return Prints out the games that can be played with two or more players.
*/
public String checkTwoPlayer() {
String result = "";
String query = "SELECT Game_Name, Game_Players FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gamePlayers = resultSet.getString("Game_Players");
if (gamePlayers.equals("1-2") || gamePlayers.equals("1-4") || gamePlayers.equals("1-8")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is compatible with four players or more.
*
* @return Prints out the games that can be played with four or more players.
*/
public String checkFourPlayer() {
String result = "";
String query = "SELECT Game_Name, Game_Players FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gamePlayers = resultSet.getString("Game_Players");
if (gamePlayers.equals("1-4") || gamePlayers.equals("1-8")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is compatible with eight players
*
* @return Prints out the games that can be played with eight players.
*/
public String checkEightPlayer() {
String result = "";
String query = "SELECT Game_Name, Game_Players FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gamePlayers = resultSet.getString("Game_Players");
if (gamePlayers.equals("1-8")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is compatible with one player only.
*
* @return Prints out the games that can only be played alone.
*/
public String checkOnePlayerOnly() {
String result = "";
String query = "SELECT Game_Name, Game_Players FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gamePlayers = resultSet.getString("Game_Players");
if (gamePlayers.equals("1")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is USK 0
*
* @return Prints all the USK 0 games.
*/
public String checkUskZero() {
String result = "";
String query = "SELECT Game_Name, Game_USK_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
int gameUsk = resultSet.getInt("Game_USK_Rating");
if (gameUsk == 0) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is USK 6
*
* @return Prints all the USK 6 games.
*/
public String checkUskSix() {
String result = "";
String query = "SELECT Game_Name, Game_USK_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
int gameUsk = resultSet.getInt("Game_USK_Rating");
if (gameUsk == 6) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is USK 12
*
* @return Prints all the USK 12 games.
*/
public String checkUskTwelve() {
String result = "";
String query = "SELECT Game_Name, Game_USK_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
int gameUsk = resultSet.getInt("Game_USK_Rating");
if (gameUsk == 12) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is USK 16
*
* @return Prints all the USK 16 games.
*/
public String checkUskSixteen() {
String result = "";
String query = "SELECT Game_Name, Game_USK_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
int gameUsk = resultSet.getInt("Game_USK_Rating");
if (gameUsk == 16) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is USK 18
*
* @return Prints all the USK 18 games.
*/
public String checkUskEighteen() {
String result = "";
String query = "SELECT Game_Name, Game_USK_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
int gameUsk = resultSet.getInt("Game_USK_Rating");
if (gameUsk == 18) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is PEGI 3.
*
* @return Prints all the PEGI 3 games.
*/
public String checkPegiThree() {
String result = "";
String query = "SELECT Game_Name, Game_PEGI_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
int gamePegi = resultSet.getInt("Game_PEGI_Rating");
if (gamePegi == 3) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is PEGI 7.
*
* @return Prints all the PEGI 7 games.
*/
public String checkPegiSeven() {
String result = "";
String query = "SELECT Game_Name, Game_PEGI_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
int gamePegi = resultSet.getInt("Game_PEGI_Rating");
if (gamePegi == 7) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is PEGI 12.
*
* @return Prints all the PEGI 12 games.
*/
public String checkPegiTwelve() {
String result = "";
String query = "SELECT Game_Name, Game_PEGI_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
int gamePegi = resultSet.getInt("Game_PEGI_Rating");
if (gamePegi == 12) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is PEGI 16.
*
* @return Prints all the PEGI 16 games.
*/
public String checkPegiSixteen() {
String result = "";
String query = "SELECT Game_Name, Game_PEGI_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
int gamePegi = resultSet.getInt("Game_PEGI_Rating");
if (gamePegi == 16) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is PEGI 18.
*
* @return Prints all the PEGI 18 games.
*/
public String checkPegiEighteen() {
String result = "";
String query = "SELECT Game_Name, Game_PEGI_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
int gamePegi = resultSet.getInt("Game_PEGI_Rating");
if (gamePegi == 18) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game has no PEGI rating.
*
* @return Prints all the games without a PEGI rating.
*/
public String checkPegiUnknown() {
String result = "";
String query = "SELECT Game_Name, Game_PEGI_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
int gamePegi = resultSet.getInt("Game_PEGI_Rating");
if (gamePegi == 0) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is ESRB E.
*
* @return Prints all the ESRB E games.
*/
public String checkEsrbE() {
String result = "";
String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameEsrb = resultSet.getString("Game_ESRB_Rating");
if (gameEsrb.equals("E")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is ESRB E10+.
*
* @return Prints all the ESRB E10+ games.
*/
public String checkEsrbEten() {
String result = "";
String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameEsrb = resultSet.getString("Game_ESRB_Rating");
if (gameEsrb.equals("E10+")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is ESRB T.
*
* @return Prints all the ESRB T games.
*/
public String checkEsrbT() {
String result = "";
String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameEsrb = resultSet.getString("Game_ESRB_Rating");
if (gameEsrb.equals("T")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is ESRB M.
*
* @return Prints all the ESRB M games.
*/
public String checkEsrbM() {
String result = "";
String query = "SELECT Game_Name, Game_ESRB_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameEsrb = resultSet.getString("Game_ESRB_Rating");
if (gameEsrb.equals("M")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is CERO A.
*
* @return Prints all the CERO A games.
*/
public String checkCeroA() {
String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameCero = resultSet.getString("Game_CERO_Rating");
if (gameCero.equals("A")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is CERO B.
*
* @return Prints all the CERO B games.
*/
public String checkCeroB() {
String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameCero = resultSet.getString("Game_CERO_Rating");
if (gameCero.equals("B")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is CERO C.
*
* @return Prints all the CERO C games.
*/
public String checkCeroC() {
String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameCero = resultSet.getString("Game_CERO_Rating");
if (gameCero.equals("C")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is CERO D.
*
* @return Prints all the CERO D games.
*/
public String checkCeroD() {
String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameCero = resultSet.getString("Game_CERO_Rating");
if (gameCero.equals("D")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is CERO Z.
*
* @return Prints all the CERO Z games.
*/
public String checkCeroZ() {
String result = "";
String query = "SELECT Game_Name, Game_CERO_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameCero = resultSet.getString("Game_CERO_Rating");
if (gameCero.equals("Z")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is ACB G.
*
* @return Prints all the ACB G games.
*/
public String checkAcbG() {
String result = "";
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameAcb = resultSet.getString("Game_ACB_Rating");
if (gameAcb.equals("G")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is ACB PG.
*
* @return Prints all the ACB PG games.
*/
public String checkAcbPg() {
String result = "";
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameAcb = resultSet.getString("Game_ACB_Rating");
if (gameAcb.equals("PG")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is ACB M.
*
* @return Prints all the ACB M games.
*/
public String checkAcbM() {
String result = "";
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameAcb = resultSet.getString("Game_ACB_Rating");
if (gameAcb.equals("M")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is ACB MA 15+.
*
* @return Prints all the ACB MA 15+ games.
*/
public String checkAcbMaFifteen() {
String result = "";
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameAcb = resultSet.getString("Game_ACB_Rating");
if (gameAcb.equals("MA 15+")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
/**
* Checks if the game is ACB R 18+.
*
* @return Prints all the ACB R 18+ games.
*/
public String checkAcbReighteen() {
String result = "";
String query = "SELECT Game_Name, Game_ACB_Rating FROM Games";
try {
Connection connection = DriverManager.getConnection(databaseURL);
Statement statement = connection.createStatement();
ResultSet resultSet = statement.executeQuery(query);
while (resultSet.next()) {
String gameName = resultSet.getString("Game_Name");
String gameAcb = resultSet.getString("Game_ACB_Rating");
if (gameAcb.equals("R 18+")) {
result += gameName + ", ";
}
}
statement.close();
connection.close();
} catch (SQLException e) {
e.printStackTrace();
}
return result.substring(0, result.length() - 2);
}
}