@ -8,7 +8,7 @@ import java.sql.Statement;
public class Games {
public class Games {
private String databaseURL = "jdbc:ucanaccess://GamesDB.accdb" ;
private String databaseURL = "jdbc:ucanaccess://GamesDB.accdb" ;
public boolean checkConnection ( ) {
public boolean checkConnection ( ) {
try {
try {
Connection connection = DriverManager . getConnection ( databaseURL ) ;
Connection connection = DriverManager . getConnection ( databaseURL ) ;
@ -20,7 +20,7 @@ public class Games {
return false ;
return false ;
}
}
}
}
public String checkConsoles ( ) {
public String checkConsoles ( ) {
String result = "" ;
String result = "" ;
String query = "SELECT Game_Console FROM Games" ;
String query = "SELECT Game_Console FROM Games" ;
@ -35,32 +35,30 @@ public class Games {
ResultSet resultSet = statement . executeQuery ( query ) ;
ResultSet resultSet = statement . executeQuery ( query ) ;
while ( resultSet . next ( ) ) {
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 + ", " ;
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 ( ) ;
statement . close ( ) ;
connection . close ( ) ;
connection . close ( ) ;
@ -68,10 +66,10 @@ public class Games {
} catch ( SQLException e ) {
} catch ( SQLException e ) {
e . printStackTrace ( ) ;
e . printStackTrace ( ) ;
}
}
/ / The substring removes the last New line in the String .
return result . substring ( 0 , result . length ( ) - 2 ) ;
return result . substring ( 0 , result . length ( ) - 2 ) ;
}
}
public String checkAllSamePublishers ( ) {
public String checkAllSamePublishers ( ) {
String result = "" ;
String result = "" ;
String query = "SELECT Game_Name, Game_Publisher_EU, Game_Publisher_JP, Game_Publisher_NA FROM Games" ;
String query = "SELECT Game_Name, Game_Publisher_EU, Game_Publisher_JP, Game_Publisher_NA FROM Games" ;
@ -83,17 +81,16 @@ public class Games {
ResultSet resultSet = statement . executeQuery ( query ) ;
ResultSet resultSet = statement . executeQuery ( query ) ;
while ( resultSet . next ( ) ) {
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 + ", " ;
}
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 ( ) ;
statement . close ( ) ;
connection . close ( ) ;
connection . close ( ) ;
@ -101,10 +98,10 @@ public class Games {
} catch ( SQLException e ) {
} catch ( SQLException e ) {
e . printStackTrace ( ) ;
e . printStackTrace ( ) ;
}
}
/ / The substring removes the last New line in the String .
return result . substring ( 0 , result . length ( ) - 2 ) ;
return result . substring ( 0 , result . length ( ) - 2 ) ;
}
}
public String checkAllDifferentPublishers ( ) {
public String checkAllDifferentPublishers ( ) {
String result = "" ;
String result = "" ;
String query = "SELECT Game_Name, Game_Publisher_EU, Game_Publisher_JP, Game_Publisher_NA FROM Games" ;
String query = "SELECT Game_Name, Game_Publisher_EU, Game_Publisher_JP, Game_Publisher_NA FROM Games" ;
@ -116,17 +113,16 @@ public class Games {
ResultSet resultSet = statement . executeQuery ( query ) ;
ResultSet resultSet = statement . executeQuery ( query ) ;
while ( resultSet . next ( ) ) {
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 + ", " ;
}
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 ( ) ;
statement . close ( ) ;
connection . close ( ) ;
connection . close ( ) ;
@ -134,10 +130,10 @@ public class Games {
} catch ( SQLException e ) {
} catch ( SQLException e ) {
e . printStackTrace ( ) ;
e . printStackTrace ( ) ;
}
}
/ / The substring removes the last New line in the String .
return result . substring ( 0 , result . length ( ) - 2 ) ;
return result . substring ( 0 , result . length ( ) - 2 ) ;
}
}
public String checkAllDifferentPublishersDeveloper ( ) {
public String checkAllDifferentPublishersDeveloper ( ) {
String result = "" ;
String result = "" ;
String query = "SELECT Game_Name, Game_Developer, Game_Publisher_EU, Game_Publisher_JP, Game_Publisher_NA FROM Games" ;
String query = "SELECT Game_Name, Game_Developer, Game_Publisher_EU, Game_Publisher_JP, Game_Publisher_NA FROM Games" ;
@ -149,18 +145,18 @@ public class Games {
ResultSet resultSet = statement . executeQuery ( query ) ;
ResultSet resultSet = statement . executeQuery ( query ) ;
while ( resultSet . next ( ) ) {
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 + ", " ;
}
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 ( ) ;
statement . close ( ) ;
connection . close ( ) ;
connection . close ( ) ;
@ -168,10 +164,10 @@ public class Games {
} catch ( SQLException e ) {
} catch ( SQLException e ) {
e . printStackTrace ( ) ;
e . printStackTrace ( ) ;
}
}
/ / The substring removes the last New line in the String .
return result . substring ( 0 , result . length ( ) - 2 ) ;
return result . substring ( 0 , result . length ( ) - 2 ) ;
}
}
public String checkAllSameReleaseDates ( ) {
public String checkAllSameReleaseDates ( ) {
String result = "" ;
String result = "" ;
String query = "SELECT Game_Name, Game_Release_EU, Game_Release_JP, Game_Release_NA, Game_Release_AU FROM Games" ;
String query = "SELECT Game_Name, Game_Release_EU, Game_Release_JP, Game_Release_NA, Game_Release_AU FROM Games" ;
@ -183,24 +179,25 @@ public class Games {
ResultSet resultSet = statement . executeQuery ( query ) ;
ResultSet resultSet = statement . executeQuery ( query ) ;
while ( resultSet . next ( ) ) {
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 + ", " ;
}
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 ( ) ;
statement . close ( ) ;
connection . close ( ) ;
connection . close ( ) ;
@ -208,10 +205,10 @@ public class Games {
} catch ( SQLException e ) {
} catch ( SQLException e ) {
e . printStackTrace ( ) ;
e . printStackTrace ( ) ;
}
}
/ / The substring removes the last New line in the String .
return result . substring ( 0 , result . length ( ) - 2 ) ;
return result . substring ( 0 , result . length ( ) - 2 ) ;
}
}
public String checkAllDifferentReleaseDates ( ) {
public String checkAllDifferentReleaseDates ( ) {
String result = "" ;
String result = "" ;
String query = "SELECT Game_Name, Game_Release_EU, Game_Release_JP, Game_Release_NA, Game_Release_AU FROM Games" ;
String query = "SELECT Game_Name, Game_Release_EU, Game_Release_JP, Game_Release_NA, Game_Release_AU FROM Games" ;
@ -223,24 +220,25 @@ public class Games {
ResultSet resultSet = statement . executeQuery ( query ) ;
ResultSet resultSet = statement . executeQuery ( query ) ;
while ( resultSet . next ( ) ) {
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 + ", " ;
}
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 ( ) ;
statement . close ( ) ;
connection . close ( ) ;
connection . close ( ) ;
@ -248,7 +246,7 @@ public class Games {
} catch ( SQLException e ) {
} catch ( SQLException e ) {
e . printStackTrace ( ) ;
e . printStackTrace ( ) ;
}
}
/ / The substring removes the last New line in the String .
return result . substring ( 0 , result . length ( ) - 2 ) ;
return result . substring ( 0 , result . length ( ) - 2 ) ;
}
}
}
}