Professional Documents
Culture Documents
Information Technology: Project Report
Information Technology: Project Report
PROJECT REPORT
SUBMITTED FOR
Done By:
R.G. Bhavadarshini
XII-C
SUBMITTED TO THE
DEPARTMENT OF INFORMATION
TECHNOLOGY
ACKNOWLEDGMENT
I would like to express my special thanks of gratitude to my teacher
topic.
1 Abstract 5
2 Problem Statement 6
Requirement Definition
3 7-8
Phase
7 Conclusion 37
8 Future Enhancement 38
ABSTRACT
Brain games challenge your mind with fun, short games that train your
memory, focus and cognitive function. For instance, a game challenging you to
workout. Word games can help improve literacy and focus. Brain games work
With each game, your mind improves itself, and in the long run brain games has
In adults, brain training games have been shown to workout existing grey
matter, and help stave off memory loss and dementia that comes with age. These
games have also been shown to boost the dendrites in your brain that are
your memory and focus with age, brain games are an excellent tool to help. For
kids, the benefits of brain training may be even greater, helping improve child
literacy, numeracy and even IQ. Kids who use brain games have been
their class to the top, all by exercising their mind just a few extra minutes a day.
PROBLEM STATEMENT
In Brain Games, a player is given three mini-games namely:
1. Quick Math
2. Text Twist
3. Atlas
Quick Math
In this mini-game, the player has a choice of addition & subtraction or
multiplication & division. In either case the player will be given two number and
the player must perform the required arithmetic operation. 10 points for a right
answer and a negative 5 points for a wrong answer.
Text Twist
In this mini-game, the player is given a word, the player how has to form
words that has same letters as that of the word given. 10 points for a right answer
and a negative 5 points for a wrong answer.
Atlas
In this mini-game, the computer gives a place which can be a city, district,
state, country, etc. the player has to type another place which starts with the same
letter as that of the ending letter given by the computer. 10 points for a right
answer and a negative 5 points for a wrong answer.
REQUIREMENT DEFINITION PHASE
Login Page
Scope:
The login credentials given by the player is checked with the data in the
database and access is granted or rejected depending on the correctness of the
credentials given.
Feasibility:
Java Method, Java MySQL Connection, Java Exception Handling and
MySQL commands.
Quick Math
Scope:
(i) The 2 numbers that are displayed, should be random
at the same time should not be too large.
(ii) The selection of addition or subtract and
multiplication or division should be random.
(iii) The score should be updated.
Feasibility:
This mini-game needs the knowledge of Java API, Java Array, Java Method,
Java Object.
Text Twist
Scope:
(i) Words should be selected at random from the database and should
be displayed.
(ii) The words given by the player should be checked.
(iii) Scores should be updated.
Feasibility:
This mini-game needs the knowledge of Java MySQL Connection, Java
Method, Java API, Java Exception Handling, SQL DDL (Data Definition
Language) and SQL DML (Data Manipulation Language).
Atlas
Scope:
(i) A Place should be selected at random from the database and should
be displayed.
(ii) The place given by the player should be checked.
(iii) The scores should be updated.
Feasibility:
This mini-game needs the knowledge of Java MySQL Connection, Java
Method, Java API, Java Exception Handling, SQL DDL (Data Definition
Language) and SQL DML (Data Manipulation Language).
DESIGN PHASE
Map of this application is given below:
Login Page
Main Page
Also the following the description of the relations used as the back-end.
TABLE – atlas
This table is used by the atlas mini-game to display a place to the player.
TABLE - userinfo
S.NO NAME TYPE REMARKS
TABLE – words
LOGIN PAGE
MAIN PAGE
QUICK MATH
ATLAS
IMPLEMENTATION PHASE
package braingames;
public static void main(String args[]){
LoginPage lp = new LoginPage();
lp.show();
}
package braingames;
import java.sql.*;
import javax.swing.JOptionPane;
public class LoginPage extends javax.swing.JFrame {
public LoginPage() {
initComponents();
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// Login Button
MainPage mp = new MainPage();
try{
String id = jTextField3.getText();
Connection
dbcon=DriverManager.getConnection("jdbc:mysql://localhost:3306/brain_games", "root",
"root");
Statement st=dbcon.createStatement();
String query="select * from UserInfo where UserId="+id;
ResultSet rs=st.executeQuery(query);
rs.next();
String pwd=rs.getString("password");
if(pwd.equals(jPasswordField1.getText())){
mp.show();
dispose();
}
else{
JOptionPane.showMessageDialog(null," incorrect Password");
}
}catch(SQLException ex)
{
System.out.println(ex.getMessage());
}catch(Exception e){
System.out.println(e.getMessage());
}
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// Exit button
System.exit(0);
}
Auto Generated codes
}
package braingames;
import java.util.Random;
import javax.swing.JOptionPane;
public class AddSub extends javax.swing.JFrame {
int i;
void CorrectNext(){
jTextField4.setText(String.valueOf(Integer.valueOf(jTextField4.getText()) + 10));
jTextField3.setText("");
String[] symbol = {"+" , "-"};
Random rm = new Random();
i = rm.nextInt(symbol.length);
jLabel2.setText(symbol[i]);
jTextField1.setText(String.valueOf((int) (Math.random() * 100)));
jTextField2.setText(String.valueOf((int) (Math.random() * 100)));
}
void WrongNext(){
jTextField4.setText(String.valueOf(Integer.valueOf(jTextField4.getText()) - 5));
jTextField3.setText("");
JOptionPane.showMessageDialog(null, "opps! incorrect answer");
String[] symbol = {"+" , "-"};
Random rm = new Random();
i = rm.nextInt(symbol.length);
jLabel2.setText(symbol[i]);
jTextField1.setText(String.valueOf((int) (Math.random() * 100)));
jTextField2.setText(String.valueOf((int) (Math.random() * 100)));
}
public AddSub() {
initComponents();
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// Start button
jLabel3.setText("=");
jTextField4.setText("0");
String[] symbol = {"+" , "-"};
Random rm = new Random();
i = rm.nextInt(symbol.length);
jLabel2.setText(symbol[i]);
jTextField1.setText(String.valueOf((int) (Math.random() * 100)));
jTextField2.setText(String.valueOf((int) (Math.random() * 100)));
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// check button
try{
int ans = Integer.valueOf(jTextField3.getText());
int num1 = Integer.valueOf(jTextField1.getText());
int num2 = Integer.valueOf(jTextField2.getText());
Random rm = new Random();
if(i==0){
if(num1+num2==ans){
CorrectNext();
}
else{
WrongNext();
}
}
else{
if((num1-num2) == ans){
CorrectNext();
}
else{
WrongNext();
}
}
}catch(NumberFormatException e){
JOptionPane.showMessageDialog(null, "please type an answer");
System.out.println(e.getMessage());
}
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// back button
QuickMath qm = new QuickMath();
qm.show();
dispose();
}
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
// back to main page
MainPage mp = new MainPage();
mp.show();
dispose();
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// exit
System.exit(0);
}
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
// restart
jTextField3.setText("");
jTextField4.setText("0");
jLabel3.setText("=");
String[] symbol = {"+" , "-"};
Random rm = new Random();
i = rm.nextInt(symbol.length);
jLabel2.setText(symbol[i]);
jTextField1.setText(String.valueOf((int) (Math.random() * 100)));
jTextField2.setText(String.valueOf((int) (Math.random() * 100)));
}
Auto Generated code
}
MulDiv.java (JFrame Form under Swing GUI Form)
package braingames;
import java.util.Random;
import javax.swing.JOptionPane;
public class MulDiv extends javax.swing.JFrame {
int i,j;
public MulDiv() {
initComponents();
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// Start button
jLabel3.setText("=");
String[] symbol = {"X" , "/"};
Random rm = new Random();
i = rm.nextInt(symbol.length);
j = (int) (Math.random() * 20);
jLabel2.setText(symbol[i]);
if(jLabel2.getText().equals("/")){
jLabel5.setVisible(true);
jTextField5.setVisible(true);
while(j==0){
j = (int) (Math.random() * 20);
}
}
else{
jLabel5.setVisible(false);
jTextField5.setVisible(false);
}
jTextField1.setText(String.valueOf((int) (Math.random() * 20)));
jTextField2.setText(String.valueOf(j));
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// check button:
try{
int ans = Integer.valueOf(jTextField3.getText());
int num1 = Integer.valueOf(jTextField1.getText());
int num2 = Integer.valueOf(jTextField2.getText());
Random rm = new Random();
if(i==0){
if(num1*num2==ans){
jTextField4.setText(String.valueOf(Integer.valueOf(jTextField4.getText()) + 10));
jTextField3.setText("");
String[] symbol = {"X" , "/"};
i = rm.nextInt(symbol.length);
j = (int) (Math.random() * 20);
jLabel2.setText(symbol[i]);
if(jLabel2.getText().equals("/")){
jLabel5.setVisible(true);
jTextField5.setVisible(true);
while(j==0){
j = (int) (Math.random() * 20);
}
}
else{
jLabel5.setVisible(false);
jTextField5.setVisible(false);
}
jTextField1.setText(String.valueOf((int) (Math.random() * 20)));
jTextField2.setText(String.valueOf(j));
}
else{
jTextField4.setText(String.valueOf(Integer.valueOf(jTextField4.getText()) - 5));
jTextField3.setText("");
String[] symbol = {"X" , "/"};
i = rm.nextInt(symbol.length);
j = (int) (Math.random() * 20);
jLabel2.setText(symbol[i]);
if(jLabel2.getText().equals("/")){
jLabel5.setVisible(true);
jTextField5.setVisible(true);
while(j==0){
j = (int) (Math.random() * 20);
}
}
else{
jLabel5.setVisible(false);
jTextField5.setVisible(false);
}
jTextField1.setText(String.valueOf((int) (Math.random() * 20)));
jTextField2.setText(String.valueOf(j));
JOptionPane.showMessageDialog(null, "opps! incorrect answer");
}
}
else{
if((num1/num2) == ans && (num1%num2) ==
Integer.valueOf(jTextField5.getText())){
jTextField3.setText("");
jTextField5.setText("");
jTextField4.setText(String.valueOf(Integer.valueOf(jTextField4.getText()) + 10));
String[] symbol = {"X" , "/"};
i = rm.nextInt(symbol.length);
j = (int) (Math.random() * 20);
jLabel2.setText(symbol[i]);
if(jLabel2.getText().equals("/")){
jLabel5.setVisible(true);
jTextField5.setVisible(true);
while(j==0){
j = (int) (Math.random() * 20);
}
}
else{
jLabel5.setVisible(false);
jTextField5.setVisible(false);
}
jTextField1.setText(String.valueOf((int) (Math.random() * 20)));
jTextField2.setText(String.valueOf(j));
}
else{
jTextField4.setText(String.valueOf(Integer.valueOf(jTextField4.getText()) - 5));
jTextField3.setText("");
jTextField5.setText("");
String[] symbol = {"X" , "/"};
i = rm.nextInt(symbol.length);
j = (int) (Math.random() * 20);
jLabel2.setText(symbol[i]);
if(jLabel2.getText().equals("/")){
jLabel5.setVisible(true);
jTextField5.setVisible(true);
while(j==0){
j = (int) (Math.random() * 20);
}
}
else{
jLabel5.setVisible(false);
jTextField5.setVisible(false);
}
jTextField1.setText(String.valueOf((int) (Math.random() * 20)));
jTextField2.setText(String.valueOf(j));
JOptionPane.showMessageDialog(null, "opps! incorrect answer");
}
}
}catch(NumberFormatException e){
JOptionPane.showMessageDialog(null, "please type an answer");
}
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// back button:
QuickMath qm = new QuickMath();
qm.show();
dispose();
}
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
// Back to main page:
MainPage mp = new MainPage();
mp.show();
dispose();
}
private void jButton6ActionPerformed(java.awt.event.ActionEvent evt) {
// restart button:
jTextField3.setText("");
jTextField4.setText("0");
jTextField5.setText("");
jLabel3.setText("=");
String[] symbol = {"X" , "/"};
Random rm = new Random();
i = rm.nextInt(symbol.length);
j = (int) (Math.random() * 20);
jLabel2.setText(symbol[i]);
if(jLabel2.getText().equals("/")){
jLabel5.setVisible(true);
jTextField5.setVisible(true);
while(j==0){
j = (int) (Math.random() * 20);
}
}
else{
jLabel5.setVisible(false);
jTextField5.setVisible(false);
}
jTextField1.setText(String.valueOf((int) (Math.random() * 20)));
jTextField2.setText(String.valueOf(j));
}
Auto generated code
}
TextTwist.java (JFrame Form under Swing GUI Form)
package braingames;
import java.sql.*;
import javax.swing.JOptionPane;
public class TextTwist extends javax.swing.JFrame {
public TextTwist() {
initComponents();
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// back to main page:
MainPage mp = new MainPage();
mp.show();
dispose();
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
// start:
try {
Connection
dbcon=DriverManager.getConnection("jdbc:mysql://localhost:3306/brain_games", "root",
"root");
Statement st=dbcon.createStatement();
String w="select * from words order by rand() limit 1";
ResultSet wo=st.executeQuery(w);
wo.next();
String word1=wo.getString("word");
jTextField1.setText(word1);
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// check:
String a=jTextField3.getText();
String b=jTextField4.getText();
String c=jTextField5.getText();
String d=jTextField6.getText();
String e=jTextField7.getText();
String f=jTextField8.getText();
String ans=jTextField1.getText();
if(ans.contains(a) && ans.contains(b) && ans.contains(c) && ans.contains(d) &&
ans.contains(e) && ans.contains(f)){
jTextField9.setText(String.valueOf(Integer.valueOf(jTextField9.getText()) + 10));
jTextField3.setText("");
jTextField4.setText("");
jTextField5.setText("");
jTextField6.setText("");
jTextField7.setText("");
jTextField8.setText("");
String word;
try {
Connection
dbcon=DriverManager.getConnection("jdbc:mysql://localhost:3306/brain_games", "root",
"root");
Statement st=dbcon.createStatement();
String w="select * from words order by rand() limit 1";
ResultSet wo=st.executeQuery(w);
wo.next();
word=wo.getString("word");
jTextField1.setText(word);
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
}
else{
jTextField9.setText(String.valueOf(Integer.valueOf(jTextField9.getText()) - 5));
JOptionPane.showMessageDialog(null, "Opps !!! Your answer is Wrong");
jTextField3.setText("");
jTextField4.setText("");
jTextField5.setText("");
jTextField6.setText("");
jTextField7.setText("");
jTextField8.setText("");
}
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// exit:
System.exit(0);
}
Auto generated code
}
package braingames;
import java.sql.*;
public class Atlas extends javax.swing.JFrame {
public Atlas() {
initComponents();
}
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {
// back to main page:
MainPage mp = new MainPage();
mp.show();
dispose();
}
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
//play (or) play again
jButton1.setText("Play Again");
jTextField4.setText("0");
try {
Connection
dbcon=DriverManager.getConnection("jdbc:mysql://localhost:3306/brain_games", "root",
"root");
Statement st=dbcon.createStatement();
String a="select place from atlas order by rand() limit 1";
ResultSet at=st.executeQuery(a);
at.next();
String val1=at.getString("place");
jTextField1.setText(val1);
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
}
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
try {
// next:
String a = jTextField1.getText().toLowerCase();
char a1 = a.charAt((a.length())-1);
String b = jTextField2.getText().toLowerCase();
char b1 = b.charAt(0);
Connection
dbcon=DriverManager.getConnection("jdbc:mysql://localhost:3306/brain_games", "root",
"root");
Statement st=dbcon.createStatement();
if(a1 ==b1){
jTextField4.setText(String.valueOf(Integer.valueOf(jTextField4.get Text()) + 10));
ResultSet word=st.executeQuery("select place from atlas order by rand() limit 1");
word.next();
jTextField1.setText(word.getString("place"));
jTextField2.setText("");
}
else{
jTextField4.setText(String.valueOf(Integer.valueOf(jTextField4.getText()) - 5));
ResultSet word=st.executeQuery("select place from atlas order by rand() limit 1");
word.next();
jTextField1.setText(word.getString("place"));
jTextField2.setText("");
}
} catch (SQLException ex) {
System.out.println(ex.getMessage());
} catch (Exception e){
System.out.println(e.getMessage());
}
}
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {
// exit:
System.exit(0);
}
Auto Generated code
}
Back-End: MySQL
The following quires are used to create a database and tables, and sample
data is inserted.
TESTING PHASE
On running the project, the main file i.e. BrainGames.java is run, and the
login page is opened
After the entry of login credentials, the main page of the game is open where
there are three sets of game to choose from,
On clicking quick math, the quick page is open as shown in the design phase.
Now on clicking Addition & Subtraction and clicking on start button,
Going back to the Quick Math page using the back button and clicking
multiplication or division followed by start button, the answer is typed
On checking using the check button, the score is incremented to 10 and the
next question is in multiplication, here the remainder text field and its label is
removed,
Now going back to the main page and clicking on Text Twist followed by
clicking the start button,
Now the answer is typed in the boxed and checked,
Now going back to main page and then to atlas (and clicking play), the
question is displayed
Since the last letter of is ‘A’ (as in Varna) the answer is typed
Since the input is correct the score is incremented and the next place is
displayed.
Thus all the parts of coding are tested and bugs are debugged.
CONCLUSION
Brain games show a higher improvement in mental performance and
problem-solving skills than those who do not. This is not entirely unexpected
considering that video games simulate and provide problems that are fun to solve,
allowing people to enjoy learning new skills that can be applied in real life
situations.
original cabbie studies and MRI studies showing growth of their hippocampi, as
well as other research showing that after brain training, EEG reports showed that
specific types of brain training changed brain activity. But the training involved
were the very same changes seen following any type of learning: playing a game
may change neural systems, but so too does studying a new language or taking
up an instrument.
FUTURE ENHANCEMENT
In the future, the brain game can be improved in aspects of using timers and
timed scores, timers were not added to these game as it is beyond the knowledge.
Other mini games such as “guess the colour”, “memory game”, “connect the
dots” “colour not the word” and many more games can be added to the list.
As we can also add animations for brain games like chess, cards and
colourful puzzles etc. in this using java as its beyond our knowledge we can
with your mind and body. Advances in technology and the rapid growth of the
brain games.