SlideShare a Scribd company logo
MENTAL AGE CALCULATOR
A mini Project Report
Submitted in partial fulfillment for the degree of
BACHELOR OF TECHNOLOGY
In
COMPUTER SCIENCE
By
Varun (15013089)
TO
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
GURU JAMBHESHWAR UNIVERSITY
OF
SCIENCE & TECHNOLOGY , HISAR
PAGE 1
Mental Age Calculator
A QUIZ BASED GAME TO CALCULATE YOUR MENTAL / EMOTIONAL AGE
VARUN ARORA | JAVA CORE & SWING | 24-01-18
PAGE 2
Acknowledgement
I consider myself privileged to express gratitude & respect
towards all those who guided me through the completion of this
project. My sincere thanks to all of them.
I am highly indebted to Mr. Amarnath who taught me the A,B &C’s of
Programming .It was him who motivated me & to learn & create code on
my own. I would like to express my gratitude towards my parents & friends
for their kind c0-operation & encouragement which help me in
completion of this project.
My thanks and appreciations also goes to my colleague in
developing the project and people who have willingly helped me
out with their abilities.
PAGE 3
DECLARATION
I, Varun, hereby declare that the report of the project entitled
“MENTAL AGE CALCULATOR” has not been presented as a part of
any other academic work to get my degree or certificate except in
GURU JAMBHESHWAR UNIVERSITY OF SCIENCE &
TECHNOLOGY , HISAR for the fulfillment of the requirements for
the degree of Bachelor of Technology (COMPUTER SCIENCE).
Varun
15013089
PAGE 4
ABSTRACT
You’re only young once but you can be immature forever.
The basic idea behind MENTAL AGE CALCULATOR is the gap between
our BIOLOGICAL & EMOTIONAL Age .
OR in simple words ,our Physical & Mental age. This quiz based game is
based upon different choices a person would make during each phase of life.
Like a child has some liking for a particular type of food in his childhood but
might not like it in some other phase .Our emotions describe who we are, why
we do the things we do & what would be our liking. Emotional or mental age
is a factor very important to describe someone’s character .A Person acting
all high & mighty could be a child at mental level. These differences inspired
the basic idea behind this project.
PAGE 5
TABLE OF CONTENTS
1. Introduction
• It’s Purpose………………………………………………………………………………………………………………………………………………....6
2. Technologies Used
• Introduction to JAVA….……………………………………………………………………………….………………………..……………7
• SWING ……………………...……………………………………………………………………………………………………….………………..7
3. Requirements
• Hardware Requirements..………….….……………………………………………………………………………………………………….8
• Software Requirements…..…..…….………………………………………………………………………………………………………….8
4. Coding……………………….………………………………………………………………………………………….....9
5. OUTPUT Snapshots……………………..………………..………………..………………………………...38
6. Further Development………………………………………………………………………….45
PAGE 6
1.INTRODUCTION
• PURPOSE
This quiz sort of game is just for referring to one’s mental age .Don’t
be offended if you got a mental age of an old one while physically still
being in your 20’s,it simply means that you’ve got a mature mind .Also
if you receive mental age of a child while actually being a old man .But
hey ,Old age is the second childhood ,right.
PAGE 7
2.Technologies Used
➢ Introduction to Java
• Java is Object oriented, Multi-threading language developed by Sun Microsystems in 1991.
• It is designed to be small, simple and portable across different platforms as well as OS.
Features of Java:
Syntax based on C++
✓ Object-oriented , Secure & portable
✓ Multithreaded & High Performance
✓ Support for Internet applications
✓ Extensive library of prewritten classes
✓ Portability among platforms
✓ Built-in networking security as JRE is inaccessible to other parts of computer
➢ Java Swing
Swing is a set of program component s for Java programmers that provide
the ability to create graphical user interface ( GUI ) components, such as buttons and
scroll bars, that are independent of the windowing system for specific operating system
. Swing components are used with the Java Foundation Classes ( JFC )
Swing provides a choice of looks and feels. For example, the same program can use
either the Java look and feel or the Windows look and feel. We expect many more look-
and-feel packages -- including some that use sound instead of a visual "look" -- to
become available from various sources.
PAGE 8
3.Requirements
Hardware:
1.) Processor PENTIUM 4 or Above
2.) Minimum 64 MB DDR SDRAM
3.) 4GB or more Hard disk space.
Software:
1.) Java JDK Platform
2.)Windows & or above
3.) Technology : Swing
4.)Environment : Command Prompt , Eclipse
PAGE 9
4.Source Code
import javax.swing.*;
import java.awt.*;
import java.awt.Color;
import java.awt.event.*;
import java.io.BufferedReader;
import java.util.*;
import java.io.*;
import java.lang.*;
public class mind3
{ int sum=0,count=0,j;
private Scanner x1;
private Formatter x;
String name,comment;
JFrame jf;
JPanel jp,jp1;
JTextField jta,jta1;
JTextArea ja=new JTextArea();
JLabel jn=new JLabel("Enter your name >>");
JScrollPane jsp,jsp1,jsp2;
PAGE 10
JButton[] jb=new JButton[6];
JButton next,submit,done;
JRadioButton[] jrb=new JRadioButton[4];
ButtonGroup bg=new ButtonGroup();
JDesktopPane dsp=new JDesktopPane();
JInternalFrame jif;
RandomAccessFile file=null;
public void external()
{ count=0; sum=0;
jf=new JFrame("Mental_age");
jp=new JPanel(new GridLayout(3,4,100,100));
jp.setOpaque(true);
jta=new JTextField(); jta.setEditable(false);
jta.setForeground(Color.black);
jta1=new JTextField(); jta1.setEditable(false);
jta1.setForeground(Color.black);
jsp=new JScrollPane(jta);
jsp1=new JScrollPane(jta1);
jsp.setBounds(405,190,600,55);
jsp1.setBounds(325,460,740,55);
jta.setBounds(250,100,80,80);
PAGE 11
jta1.setBounds(250,610,80,80);
jta.setFont(new Font("serif",Font.ITALIC,18));
jta1.setFont(new Font("serif",Font.ITALIC,18));
jta.setText("tWelcome to the gamenPlease Choose an optionn");
jta1.setText(" Game will include 10 questionsnEach of them with 4
choices.nPlease Select any one of them.");
jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
jf.setLayout(new BorderLayout());
jb[0]=new JButton("START");
jb[0].setBackground(new Color(150,50,200));
jb[0].setForeground(Color.black);
jb[1]=new JButton("LAST PLAYER'S RESULT");
jb[1].setBackground(new Color(200,200,100));
jb[1].setForeground(Color.black);
jb[2]=new JButton("HELP");
jb[2].setBackground(new Color(100,200,100));
jb[2].setForeground(Color.black);
PAGE 12
jb[3]=new JButton("EXIT");
jb[3].setBackground(new Color(100,0,50));
jb[3].setForeground(Color.black);
jb[4]=new JButton("CREATOR");
jb[4].setBackground(new Color(100,50,30));
jb[4].setForeground(Color.black);
jb[5]=new JButton("How it works");
jb[5].setBackground(new Color(100,31,51));
jb[5].setForeground(Color.black);
jb[0].setBounds(100,100,50,30); jb[0].setToolTipText("Start the game");
jb[1].setBounds(300,100,50,30); jb[1].setToolTipText("Check Preious
player's Record");
jb[2].setBounds(100,280,50,30); jb[2].setToolTipText("Need Some help");
jb[3].setBounds(300,280,50,30); jb[3].setToolTipText("You sure You wanna
exit??");
jb[4].setBounds(100,280,50,30); jb[4].setToolTipText("whom this belongs
to");
jb[5].setBounds(300,280,50,30); jb[5].setToolTipText("Thought process");
jb[0].addActionListener(new ActionListener()
PAGE 13
{ public void actionPerformed(ActionEvent e)
{
start();
}
}
);
jb[1].addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent e)
{ jf.getContentPane().setBackground(Color.orange);
records();
}
}
);
jb[2].addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent e)
{ jf.getContentPane().setBackground(new
Color(100,200,100));
help(); }
}
);
jb[3].addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent e)
PAGE 14
{ exit(); }
}
);
jb[4].addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent e)
{ jf.getContentPane().setBackground(new
Color(100,50,30));
info(); }
}
);
jb[5].addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent e)
{ jf.getContentPane().setBackground(new Color(100,31,51));
how(); }
}
);
for(int i=0;i<7;i++)
{ if(i==6)
continue;
jb[i].setFont(new Font("Segoe Script",Font.PLAIN,30));
jp.add(jb[i]);
}
PAGE 15
jf.add(jsp);
jf.add(jsp1);
jf.add(jp);
jf.pack();
jf.setSize(1800,750);
jf.setVisible(true);
}
public void start()
{
count=count+1; ja.setText(""); ja.setEditable(false);
next=new JButton("Next>>");
jp1=new JPanel(new GridLayout(6,1,1,1));
jsp1=new JScrollPane(ja);
jsp1.setBounds(200,200,510,300);
jp1.setBounds(0,0,100,25);
ja.setBounds(0,200,510,300);
ja.setFont(new Font("serif",Font.PLAIN,30));
PAGE 16
switch(count)
{
case 1:
ja.setText("tQuestion 1 :nChoose your favorite set of colors >>");
jrb[1]=new JRadioButton("Black , Grey , Brown");
jrb[2]=new JRadioButton("Royal blue , Neon , Yellow");
jrb[0]=new JRadioButton("Mix , Skyblue , Pinkish red");
jrb[3]=new JRadioButton("Light yellow , Light brown , Light grey");
jf.getContentPane().setBackground(Color.black);
break;
case 2:
ja.setText("tQuestion : 2nChoose a meal >>");
jrb[3]=new JRadioButton("Seafood");
jrb[2]=new JRadioButton("Takeaway food");
jrb[0]=new JRadioButton("Fast food");
jrb[1]=new JRadioButton("Soup");
jf.getContentPane().setBackground(Color.lightGray);
break;
PAGE 17
case 3:
ja.setText("tQuestion : 3nChoose your drink to go with the
meal>>");
jrb[0]=new JRadioButton("Softdrink , Lemonade");
jrb[1]=new JRadioButton("Beer");
jrb[3]=new JRadioButton("Redwine");
jrb[2]=new JRadioButton("Fruit Juice");
jf.getContentPane().setBackground(Color.darkGray);
break;
case 4:
ja.setText("tQuestion : 4ntWhat would you like to watch now>>");
jrb[3]=new JRadioButton("Documentary");
jrb[0]=new JRadioButton("Cartoons");
jrb[2]=new JRadioButton("Action / Comedy");
jrb[1]=new JRadioButton("Drama / Thriller");
jf.getContentPane().setBackground(Color.blue);
break;
case 5:
ja.setText("tQuestion : 5nWhat's your opinion on candy>>");
jrb[0]=new JRadioButton("Love it");
PAGE 18
jrb[2]=new JRadioButton("It's ok");
jrb[1]=new JRadioButton("It's for kids");
jrb[3]=new JRadioButton("It's Unhealthy / Avoid it");
jf.getContentPane().setBackground(Color.magenta);
break;
case 6:
ja.setText("tQuestion : 6nWhat's your opinion on social media like
twitter or facebook >>");
jrb[2]=new JRadioButton("Useful");
jrb[1]=new JRadioButton("Waste of time");
jrb[0]=new JRadioButton("Essential");
jrb[3]=new JRadioButton("Confused");
jf.getContentPane().setBackground(Color.pink);
break;
case 7:
ja.setText("tQuestion : 7nWhat'll be your opinion on Smart
phones>>");
jrb[2]=new JRadioButton("Useful");
jrb[0]=new JRadioButton("Necessary");
jrb[3]=new JRadioButton("Confusing");
jrb[1]=new JRadioButton("Expensive");
PAGE 19
jf.getContentPane().setBackground(Color.orange);
break;
case 8:
ja.setText("tQuestion : 8nHow would you like to celebrate your
Birthday>>");
jrb[3]=new JRadioButton("It's for kids");
jrb[1]=new JRadioButton("Meal with family");
jrb[2]=new JRadioButton("Partying & Drinking");
jrb[0]=new JRadioButton("Birthday games & cakes");
jf.getContentPane().setBackground(Color.red);
break;
case 9:
ja.setText("tQuestion : 9nWhat's your opinion on classical
music>>");
jrb[1]=new JRadioButton("Relaxing");
jrb[0]=new JRadioButton("Hate it");
jrb[3]=new JRadioButton("Love it");
jrb[2]=new JRadioButton("It's okay");
jf.getContentPane().setBackground(Color.green);
break;
PAGE 20
case 10:
ja.setText("tQuestion : 10nWhat would your ideal vacation consist
of>>");
jrb[0]=new JRadioButton("Going to theme Park like DisneyLand");
jrb[1]=new JRadioButton("Beach / Hawaii / Spain");
jrb[2]=new JRadioButton("Touring : Italy / New York");
jrb[3]=new JRadioButton("Experiencing new cultures");
jf.getContentPane().setBackground(Color.cyan);
break;
}
jrb[0].addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent be)
{
sum=sum+40;
}
});
jrb[1].addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent be)
{
sum=sum+20;
PAGE 21
}
});
jrb[2].addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent be)
{
sum=sum+30;
}
});
jrb[3].addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent be)
{
sum=sum+10;
}
});
next.setBounds(400,50,100,20); next.setToolTipText("Next Question");
next.setFont(new Font("Serif",Font.ITALIC,40));
next.addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent e)
{jif.dispose();
PAGE 22
if(count==10)
{
System.out.println("sum = "+sum+" count = "+count);
addcomment(sum);
}
start();
}
});
jp1.add(jsp1);
for(int i=0;i<4;i++)
{ jrb[i].setFont(new Font("Segoe Script",Font.ITALIC+Font.BOLD,30));
bg.add(jrb[i]);
jp1.add(jrb[i]);
}
jp1.add(next);
PAGE 23
jif=new JInternalFrame("Here's the game!!");
jif.setBounds(330,40,320,260);
jif.setIconifiable(true);
jif.setSize(800,600);
jif.setResizable(true);
jif.setVisible(true);
jif.add(jp1);
dsp.add(jif);
jf.add(dsp);
jf.setContentPane(dsp);
dsp.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
public void addcomment(int score)
{
if(score>=350&&score<=400)
comment="your mental age is between 4 to 9 years.nWith a childish
nature,you can find joy,namusement from simplest of things.";
else if(score>=300&&score<=340)
PAGE 24
comment="you have a teenager's mind ie in between 9 to 16.nFairly
immature & can sometimes rebel against the normal one's.nYou're a quirky
character";
else if(score>=250&&score<=290)
comment="your mental age is between 16 to 21 years.nYou know when
to act maturely but also knows how to have fun.nYou can act immature &
seriously whenever you see fit";
else if(score>=200&&score<=240)
comment="your mental age is between 21 to 29 years.nYou've a young
adult's mind acting mature most of the time & knows nwhen to be
serious.Intelligent & self aware.";
else if(score>=150&&score<=190)
comment="your mental age is between 29 to 55 years.nYou are a mature
adult.Modest & noble with good manners.nEqually good etiquette.You have
all the properties to become a Connoisseur";
else if(score>=100&&score<=140)
comment="your mental age is above 55,man that's old .nYou appreciate
simple things & nare not bothered with your environment being modern. ";
else
comment="Maybe next time";
PAGE 25
JTextField jj=new JTextField();
done=new JButton("Done ");
submit=new JButton("SUBMIT");
jp1=new JPanel(new GridLayout(4,1,1,1));
jsp1=new JScrollPane(jj);
jsp1.setBounds(100,400,300,80);
jj.setBounds(100,400,300,80);
jj.setFont(new Font("serif",Font.ITALIC,40)); jn.setFont(new
Font("serif",Font.BOLD+Font.ITALIC,30));
submit.setFont(new Font("vandana",Font.ITALIC+Font.BOLD,28));
submit.addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent e)
{ name=jj.getText();
jif.dispose();
System.out.println(name);
show(); //return;
}
});
jp1.add(jn);
jp1.add(jsp1);
PAGE 26
jp1.add(submit);
jif=new JInternalFrame("Enter your name >>");
jif.setBounds(330,40,320,260);
jif.setIconifiable(true);
jif.setSize(800,600);
jif.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
jif.setVisible(true);
jif.add(jp1);
dsp.add(jif);
jf.add(dsp);
jf.setContentPane(dsp);
dsp.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
}
public void show()
{ JTextArea jj=new JTextArea();
done=new JButton("Done ");
PAGE 27
jp1=new JPanel(new GridLayout(4,1,1,1));
jsp1=new JScrollPane(jj);
jsp1.setBounds(100,400,300,80);
jj.setBounds(100,400,300,80);
jj.setFont(new Font("serif",Font.ITALIC,20)); jn.setFont(new
Font("serif",Font.BOLD+Font.ITALIC,30));
jn.setText("Result >>");
jj.setText(" "+name+" ,"+comment);
jj.setEditable(false);
done.setFont(new Font("vandana",Font.ITALIC,20));
done.addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent e)
{ jif.dispose();
jf.dispose();
addrecord();
external();
}
});
jp1.add(jn);
PAGE 28
jp1.add(jsp1);
jp1.add(done);
jif=new JInternalFrame("Done !!");
jif.setBounds(330,40,320,260);
jif.setIconifiable(true);
jif.setSize(800,600);
jif.setVisible(true);
jif.add(jp1);
dsp.add(jif);
jf.add(dsp);
jf.setContentPane(dsp);
dsp.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
}
public void addrecord()
{ open();
try
{
x.format("%s %d %sn",name,sum,comment);
PAGE 29
}catch(Exception e){System.out.println(e);}
close();
}
public void open()
{ try
{x=new Formatter("records.txt");
}catch(Exception e){System.out.println(e);}
}
public void close()
{ try
{x.close();
}catch(Exception e){System.out.println(e);}
}
public void records()
{ jf.getContentPane().setBackground(Color.blue);
JTextArea jj=new JTextArea("");
jj.setLineWrap(true);
jsp2=new JScrollPane(jj);
jp1=new JPanel(new GridLayout(2,1,1,1)); jp1.setBounds(100,400,100,50);
jp1.setOpaque(true);
JButton bm=new JButton("<< Back to Menu");
bm.setBounds(100,400,100,50);
PAGE 30
bm.setToolTipText("Back to Main Menu"); bm.setFont(new
Font("Serif",Font.ITALIC,30));
bm.addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent e)
{ jif.dispose();
jf.dispose();
external();
}
});
try
{ x1=new Scanner(new File("records.txt"));
while(x1.hasNextLine())
{ String Line=x1.nextLine();
jj.append(Line);
}
}
catch(Exception e){System.out.println(e);}
jsp2.setBounds(0,0,100,150);
jj.setBounds(0,0,800,300);
PAGE 31
jj.setFont(new Font("Segoe Script",Font.BOLD,30));
jj.setEditable(false);
jif=new JInternalFrame("Here's the game!!");
jif.setBounds(330,40,400,300);
jif.setIconifiable(true);
jif.setSize(800,600);
jif.setVisible(true);
jp1.add(jsp2);
jp1.add(bm);
jif.add(jp1);
dsp.add(jif);
jf.add(dsp);
jf.setContentPane(dsp);
dsp.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
}
public void help()
{
JTextArea jj=new JTextArea();
jsp2=new JScrollPane(jj);
jp1=new JPanel(new GridLayout(2,1,1,1));
JButton bm=new JButton("<< Back to Menu");
PAGE 32
bm.setBounds(100,100,10,10);
bm.setToolTipText("Back to Main Menu"); bm.setFont(new
Font("Serif",Font.ITALIC,30));
bm.addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent e)
{ jif.dispose();
jf.dispose();
external();
}
});
jsp2.setBounds(0,0,600,150);
jj.setEditable(false);
jj.setBounds(0,0,400,150);
jj.setFont(new Font("serif",Font.PLAIN,18));
jj.setText("t>>~~HELP MENU~~n=>>You must be aware of your
age.n=>>But that's the age of your body ,a physical entity.n=>>This is a
game to calculate your mental age.n=>>The age of your mind or so to speak
,the maturity of your mind,that has nothing to do with the physical nage in
most cases. n=>>Here you'll be facing 10 Questions with 4 choices,each of
them is assigned a certain amount.n=>>Depending on what option you
choose a certain amount is added to your score.n=>>Minimum amount is 10
& maximum is 40.n=>>At the end of the game: nYour mental age with a
comment will be displayed.");
PAGE 33
jif=new JInternalFrame("Here you go");
jif.setBounds(330,40,400,300);
jif.setIconifiable(true);
jif.setSize(800,600);
jif.setVisible(true);
jp1.add(jsp2);
jp1.add(bm);
jif.add(jp1);
dsp.add(jif);
jf.add(dsp);
jf.setContentPane(dsp);
dsp.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
}
public void exit()
{ jf.dispose();
return ;
}
PAGE 34
public void info()
{ JTextArea jj=new JTextArea();
jsp2=new JScrollPane(jj);
jp1=new JPanel(new GridLayout(2,1,1,1));
JButton bm=new JButton("<< Back to Menu");
bm.setBounds(100,100,10,10);
bm.setToolTipText("Back to Main Menu");
bm.setFont(new Font("Serif",Font.ITALIC,30));
bm.addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent e)
{ jif.dispose();
jf.dispose();
external();
}
});
jsp2.setBounds(0,0,600,150);
jj.setEditable(false);
jj.setBounds(0,0,400,150);
jj.setFont(new Font("segoe script",Font.PLAIN,20));
PAGE 35
jj.setText("ntMental Age CalculatornCreated by:tVarunntBTCSE
15013089ntCSE Batch-2ndnStudent of: tGURU JAMBHESHWAR
UNIVERISTY OF ntSCIENCE & TECHNOLOGY");
jj.append("nEmail id: twww.varunarora714@gmail.comnAdmitted
in:t2015");
jif=new JInternalFrame("Here you go");
jif.setBounds(330,40,400,300);
jif.setIconifiable(true);
jif.setSize(800,600);
jif.setVisible(true);
jp1.add(jsp2);
jp1.add(bm);
jif.add(jp1);
dsp.add(jif);
jf.add(dsp);
jf.setContentPane(dsp);
dsp.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
}
public void how()
{ JTextArea jj=new JTextArea();
PAGE 36
jsp2=new JScrollPane(jj);
jp1=new JPanel(new GridLayout(2,1,1,1));
JButton bm=new JButton("<< Back to Menu");
bm.setBounds(100,100,10,10);
bm.setToolTipText("Back to Main Menu");
bm.setFont(new Font("Segoe script",Font.ITALIC,30));
bm.addActionListener(new ActionListener()
{ public void actionPerformed(ActionEvent e)
{ jif.dispose();
jf.dispose();
external();
}
});
jsp2.setBounds(0,0,600,150);
jj.setEditable(false);
jj.setBounds(0,0,400,150);
jj.setFont(new Font("serif",Font.PLAIN,20));
jj.setText("ntEvery person around us has their own way of
thinking.nA person with the age of an average adult may not act like an
PAGE 37
adult whereas a child at the age of 10 nmight actually behave like
one.ntThe thing is our mind grows different than our bodies.According to
the choices our nmind makes for us,an age group can be deduced for our
mind.In this game you'll be facing 10 nquestions,according to the choices
you make ,an age group is narrowed & will be shown as yourn result.Choose
carefully! ");
jif=new JInternalFrame("the idea");
jif.setBounds(330,40,400,300);
jif.setIconifiable(true);
jif.setSize(800,600);
jif.setVisible(true);
jp1.add(jsp2);
jp1.add(bm);
jif.add(jp1);
dsp.add(jif);
jf.add(dsp);
jf.setContentPane(dsp);
dsp.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
}
PAGE 38
public static void main(String args[])
{ mind3 m=new mind3();
m.external();
}
}
PAGE 39
5.SNAPSHOTS
Main Menu:-
PAGE 40
Working :-
PAGE 41
PAGE 42
Record Submission :-
Result :-
PAGE 43
HELP Menu :-
Previous Player’s result :-
PAGE 44
Creator’s info:-
The idea :-
PAGE 45
6.Further Development
Despite being quite accurate this idea still needs to
meet with innovation.It has the continuovs need of
updated information for changing generation to
judge people’s choices.Further scope of it’s
development would be to merge it with an Artificial
Intellligent system which can interact with
people,provide response,humour them, read their
choices & do more stuff.
By collecting data on a single person per database
It can be true to the mark when there is a need to
judge it’s owner’s character.
Hence the project to calculate one’s mental age is
complete.

More Related Content

DOC
Snake project report
PDF
OpenID Connect Explained
PPT
Presentation sso design_security
PPTX
Java project-presentation
PPT
Blue brain ppt
PPT
PPTX
contoh slide presentasi inggris
PDF
A mini project on designing a DATABASE for Library management system using mySQL
Snake project report
OpenID Connect Explained
Presentation sso design_security
Java project-presentation
Blue brain ppt
contoh slide presentasi inggris
A mini project on designing a DATABASE for Library management system using mySQL

What's hot (20)

DOCX
Industrial Training report on java
PPT
ppt on sOFTWARE DEVELOPMENT LIFE CYCLE
PPT
project on snake game in c language
PPT
java Project report online banking system
PDF
Bank Database using MySQL
DOCX
Industrial training report on core java
PPTX
Screenless Display technology for the future.
PPTX
Formal Approaches to SQA.pptx
PDF
Final project report Snake Game in Python
PPTX
Quiz application
PPTX
Prototype model
PPTX
Software development life cycle (SDLC)
PPT
USER INTERFACE DESIGN PPT
DOC
Tic tac toe game code
DOCX
BANK MANAGEMENT SYSTEM report
PDF
Project report 393_395
PPTX
Bank management system
PDF
10-Software Project Management (Object Oriented Software Engineering - BNU Sp...
PPTX
PDF
The Mobile Ecosystem
Industrial Training report on java
ppt on sOFTWARE DEVELOPMENT LIFE CYCLE
project on snake game in c language
java Project report online banking system
Bank Database using MySQL
Industrial training report on core java
Screenless Display technology for the future.
Formal Approaches to SQA.pptx
Final project report Snake Game in Python
Quiz application
Prototype model
Software development life cycle (SDLC)
USER INTERFACE DESIGN PPT
Tic tac toe game code
BANK MANAGEMENT SYSTEM report
Project report 393_395
Bank management system
10-Software Project Management (Object Oriented Software Engineering - BNU Sp...
The Mobile Ecosystem
Ad

Similar to Mini project in java swing (20)

DOCX
Final documentation major proj_js
PPT
Making a game "Just Right" through testing and play balancing
DOCX
BeeT 3D documentation
DOCX
Final Project Submission Document file
PDF
Units 14, 15 Assignment brief
DOCX
Project 2
PPTX
Game Design as an Intro to Computer Science (Meaningful Play 2014)
DOC
Snake game implementation in c
PPT
ma project
DOCX
Training report anish
PDF
Selenium web driver | java
DOCX
PDF
Quiz app (android) Documentation
PDF
Creating_Installers_for_Java_Applications-report
PDF
Creating_Installers_for_Java_Applications-report
DOCX
Game engines
PDF
Sustainable software institute Collaboration workshop
DOCX
AJP Typing Master.docx
DOCX
AJP Microproject.docx
PPTX
Android Beat the-quiz application
Final documentation major proj_js
Making a game "Just Right" through testing and play balancing
BeeT 3D documentation
Final Project Submission Document file
Units 14, 15 Assignment brief
Project 2
Game Design as an Intro to Computer Science (Meaningful Play 2014)
Snake game implementation in c
ma project
Training report anish
Selenium web driver | java
Quiz app (android) Documentation
Creating_Installers_for_Java_Applications-report
Creating_Installers_for_Java_Applications-report
Game engines
Sustainable software institute Collaboration workshop
AJP Typing Master.docx
AJP Microproject.docx
Android Beat the-quiz application
Ad

More from varun arora (10)

PPTX
Computer networks and it's applications
PPTX
Dna digital data storage
PDF
Advance Java Practical file
PDF
Dot Net Project Mini Game
PPTX
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
DOCX
Billing in a supermarket c++
DOCX
Institute management
DOCX
Computer graphics File for Engineers
DOCX
Project fast food automaton
DOCX
Macromedia Flash Player Practical file
Computer networks and it's applications
Dna digital data storage
Advance Java Practical file
Dot Net Project Mini Game
Backtracking-N Queens Problem-Graph Coloring-Hamiltonian cycle
Billing in a supermarket c++
Institute management
Computer graphics File for Engineers
Project fast food automaton
Macromedia Flash Player Practical file

Recently uploaded (20)

PDF
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
PDF
Event Presentation Google Cloud Next Extended 2025
PDF
KodekX | Application Modernization Development
PDF
Dell Pro 14 Plus: Be better prepared for what’s coming
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
A Day in the Life of Location Data - Turning Where into How.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Enable Enterprise-Ready Security on IBM i Systems.pdf
PDF
Smarter Business Operations Powered by IoT Remote Monitoring
PDF
Top Generative AI Tools for Patent Drafting in 2025.pdf
PPTX
How to Build Crypto Derivative Exchanges from Scratch.pptx
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
Belt and Road Supply Chain Finance Blockchain Solution
PDF
Modernizing your data center with Dell and AMD
PDF
CIFDAQ's Teaching Thursday: Moving Averages Made Simple
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
Event Presentation Google Cloud Next Extended 2025
KodekX | Application Modernization Development
Dell Pro 14 Plus: Be better prepared for what’s coming
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
A Day in the Life of Location Data - Turning Where into How.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Understanding_Digital_Forensics_Presentation.pptx
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Enable Enterprise-Ready Security on IBM i Systems.pdf
Smarter Business Operations Powered by IoT Remote Monitoring
Top Generative AI Tools for Patent Drafting in 2025.pdf
How to Build Crypto Derivative Exchanges from Scratch.pptx
NewMind AI Weekly Chronicles - August'25 Week I
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Belt and Road Supply Chain Finance Blockchain Solution
Modernizing your data center with Dell and AMD
CIFDAQ's Teaching Thursday: Moving Averages Made Simple

Mini project in java swing

  • 1. MENTAL AGE CALCULATOR A mini Project Report Submitted in partial fulfillment for the degree of BACHELOR OF TECHNOLOGY In COMPUTER SCIENCE By Varun (15013089) TO DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING GURU JAMBHESHWAR UNIVERSITY OF SCIENCE & TECHNOLOGY , HISAR
  • 2. PAGE 1 Mental Age Calculator A QUIZ BASED GAME TO CALCULATE YOUR MENTAL / EMOTIONAL AGE VARUN ARORA | JAVA CORE & SWING | 24-01-18
  • 3. PAGE 2 Acknowledgement I consider myself privileged to express gratitude & respect towards all those who guided me through the completion of this project. My sincere thanks to all of them. I am highly indebted to Mr. Amarnath who taught me the A,B &C’s of Programming .It was him who motivated me & to learn & create code on my own. I would like to express my gratitude towards my parents & friends for their kind c0-operation & encouragement which help me in completion of this project. My thanks and appreciations also goes to my colleague in developing the project and people who have willingly helped me out with their abilities.
  • 4. PAGE 3 DECLARATION I, Varun, hereby declare that the report of the project entitled “MENTAL AGE CALCULATOR” has not been presented as a part of any other academic work to get my degree or certificate except in GURU JAMBHESHWAR UNIVERSITY OF SCIENCE & TECHNOLOGY , HISAR for the fulfillment of the requirements for the degree of Bachelor of Technology (COMPUTER SCIENCE). Varun 15013089
  • 5. PAGE 4 ABSTRACT You’re only young once but you can be immature forever. The basic idea behind MENTAL AGE CALCULATOR is the gap between our BIOLOGICAL & EMOTIONAL Age . OR in simple words ,our Physical & Mental age. This quiz based game is based upon different choices a person would make during each phase of life. Like a child has some liking for a particular type of food in his childhood but might not like it in some other phase .Our emotions describe who we are, why we do the things we do & what would be our liking. Emotional or mental age is a factor very important to describe someone’s character .A Person acting all high & mighty could be a child at mental level. These differences inspired the basic idea behind this project.
  • 6. PAGE 5 TABLE OF CONTENTS 1. Introduction • It’s Purpose………………………………………………………………………………………………………………………………………………....6 2. Technologies Used • Introduction to JAVA….……………………………………………………………………………….………………………..……………7 • SWING ……………………...……………………………………………………………………………………………………….………………..7 3. Requirements • Hardware Requirements..………….….……………………………………………………………………………………………………….8 • Software Requirements…..…..…….………………………………………………………………………………………………………….8 4. Coding……………………….………………………………………………………………………………………….....9 5. OUTPUT Snapshots……………………..………………..………………..………………………………...38 6. Further Development………………………………………………………………………….45
  • 7. PAGE 6 1.INTRODUCTION • PURPOSE This quiz sort of game is just for referring to one’s mental age .Don’t be offended if you got a mental age of an old one while physically still being in your 20’s,it simply means that you’ve got a mature mind .Also if you receive mental age of a child while actually being a old man .But hey ,Old age is the second childhood ,right.
  • 8. PAGE 7 2.Technologies Used ➢ Introduction to Java • Java is Object oriented, Multi-threading language developed by Sun Microsystems in 1991. • It is designed to be small, simple and portable across different platforms as well as OS. Features of Java: Syntax based on C++ ✓ Object-oriented , Secure & portable ✓ Multithreaded & High Performance ✓ Support for Internet applications ✓ Extensive library of prewritten classes ✓ Portability among platforms ✓ Built-in networking security as JRE is inaccessible to other parts of computer ➢ Java Swing Swing is a set of program component s for Java programmers that provide the ability to create graphical user interface ( GUI ) components, such as buttons and scroll bars, that are independent of the windowing system for specific operating system . Swing components are used with the Java Foundation Classes ( JFC ) Swing provides a choice of looks and feels. For example, the same program can use either the Java look and feel or the Windows look and feel. We expect many more look- and-feel packages -- including some that use sound instead of a visual "look" -- to become available from various sources.
  • 9. PAGE 8 3.Requirements Hardware: 1.) Processor PENTIUM 4 or Above 2.) Minimum 64 MB DDR SDRAM 3.) 4GB or more Hard disk space. Software: 1.) Java JDK Platform 2.)Windows & or above 3.) Technology : Swing 4.)Environment : Command Prompt , Eclipse
  • 10. PAGE 9 4.Source Code import javax.swing.*; import java.awt.*; import java.awt.Color; import java.awt.event.*; import java.io.BufferedReader; import java.util.*; import java.io.*; import java.lang.*; public class mind3 { int sum=0,count=0,j; private Scanner x1; private Formatter x; String name,comment; JFrame jf; JPanel jp,jp1; JTextField jta,jta1; JTextArea ja=new JTextArea(); JLabel jn=new JLabel("Enter your name >>"); JScrollPane jsp,jsp1,jsp2;
  • 11. PAGE 10 JButton[] jb=new JButton[6]; JButton next,submit,done; JRadioButton[] jrb=new JRadioButton[4]; ButtonGroup bg=new ButtonGroup(); JDesktopPane dsp=new JDesktopPane(); JInternalFrame jif; RandomAccessFile file=null; public void external() { count=0; sum=0; jf=new JFrame("Mental_age"); jp=new JPanel(new GridLayout(3,4,100,100)); jp.setOpaque(true); jta=new JTextField(); jta.setEditable(false); jta.setForeground(Color.black); jta1=new JTextField(); jta1.setEditable(false); jta1.setForeground(Color.black); jsp=new JScrollPane(jta); jsp1=new JScrollPane(jta1); jsp.setBounds(405,190,600,55); jsp1.setBounds(325,460,740,55); jta.setBounds(250,100,80,80);
  • 12. PAGE 11 jta1.setBounds(250,610,80,80); jta.setFont(new Font("serif",Font.ITALIC,18)); jta1.setFont(new Font("serif",Font.ITALIC,18)); jta.setText("tWelcome to the gamenPlease Choose an optionn"); jta1.setText(" Game will include 10 questionsnEach of them with 4 choices.nPlease Select any one of them."); jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); jf.setLayout(new BorderLayout()); jb[0]=new JButton("START"); jb[0].setBackground(new Color(150,50,200)); jb[0].setForeground(Color.black); jb[1]=new JButton("LAST PLAYER'S RESULT"); jb[1].setBackground(new Color(200,200,100)); jb[1].setForeground(Color.black); jb[2]=new JButton("HELP"); jb[2].setBackground(new Color(100,200,100)); jb[2].setForeground(Color.black);
  • 13. PAGE 12 jb[3]=new JButton("EXIT"); jb[3].setBackground(new Color(100,0,50)); jb[3].setForeground(Color.black); jb[4]=new JButton("CREATOR"); jb[4].setBackground(new Color(100,50,30)); jb[4].setForeground(Color.black); jb[5]=new JButton("How it works"); jb[5].setBackground(new Color(100,31,51)); jb[5].setForeground(Color.black); jb[0].setBounds(100,100,50,30); jb[0].setToolTipText("Start the game"); jb[1].setBounds(300,100,50,30); jb[1].setToolTipText("Check Preious player's Record"); jb[2].setBounds(100,280,50,30); jb[2].setToolTipText("Need Some help"); jb[3].setBounds(300,280,50,30); jb[3].setToolTipText("You sure You wanna exit??"); jb[4].setBounds(100,280,50,30); jb[4].setToolTipText("whom this belongs to"); jb[5].setBounds(300,280,50,30); jb[5].setToolTipText("Thought process"); jb[0].addActionListener(new ActionListener()
  • 14. PAGE 13 { public void actionPerformed(ActionEvent e) { start(); } } ); jb[1].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jf.getContentPane().setBackground(Color.orange); records(); } } ); jb[2].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jf.getContentPane().setBackground(new Color(100,200,100)); help(); } } ); jb[3].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e)
  • 15. PAGE 14 { exit(); } } ); jb[4].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jf.getContentPane().setBackground(new Color(100,50,30)); info(); } } ); jb[5].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jf.getContentPane().setBackground(new Color(100,31,51)); how(); } } ); for(int i=0;i<7;i++) { if(i==6) continue; jb[i].setFont(new Font("Segoe Script",Font.PLAIN,30)); jp.add(jb[i]); }
  • 16. PAGE 15 jf.add(jsp); jf.add(jsp1); jf.add(jp); jf.pack(); jf.setSize(1800,750); jf.setVisible(true); } public void start() { count=count+1; ja.setText(""); ja.setEditable(false); next=new JButton("Next>>"); jp1=new JPanel(new GridLayout(6,1,1,1)); jsp1=new JScrollPane(ja); jsp1.setBounds(200,200,510,300); jp1.setBounds(0,0,100,25); ja.setBounds(0,200,510,300); ja.setFont(new Font("serif",Font.PLAIN,30));
  • 17. PAGE 16 switch(count) { case 1: ja.setText("tQuestion 1 :nChoose your favorite set of colors >>"); jrb[1]=new JRadioButton("Black , Grey , Brown"); jrb[2]=new JRadioButton("Royal blue , Neon , Yellow"); jrb[0]=new JRadioButton("Mix , Skyblue , Pinkish red"); jrb[3]=new JRadioButton("Light yellow , Light brown , Light grey"); jf.getContentPane().setBackground(Color.black); break; case 2: ja.setText("tQuestion : 2nChoose a meal >>"); jrb[3]=new JRadioButton("Seafood"); jrb[2]=new JRadioButton("Takeaway food"); jrb[0]=new JRadioButton("Fast food"); jrb[1]=new JRadioButton("Soup"); jf.getContentPane().setBackground(Color.lightGray); break;
  • 18. PAGE 17 case 3: ja.setText("tQuestion : 3nChoose your drink to go with the meal>>"); jrb[0]=new JRadioButton("Softdrink , Lemonade"); jrb[1]=new JRadioButton("Beer"); jrb[3]=new JRadioButton("Redwine"); jrb[2]=new JRadioButton("Fruit Juice"); jf.getContentPane().setBackground(Color.darkGray); break; case 4: ja.setText("tQuestion : 4ntWhat would you like to watch now>>"); jrb[3]=new JRadioButton("Documentary"); jrb[0]=new JRadioButton("Cartoons"); jrb[2]=new JRadioButton("Action / Comedy"); jrb[1]=new JRadioButton("Drama / Thriller"); jf.getContentPane().setBackground(Color.blue); break; case 5: ja.setText("tQuestion : 5nWhat's your opinion on candy>>"); jrb[0]=new JRadioButton("Love it");
  • 19. PAGE 18 jrb[2]=new JRadioButton("It's ok"); jrb[1]=new JRadioButton("It's for kids"); jrb[3]=new JRadioButton("It's Unhealthy / Avoid it"); jf.getContentPane().setBackground(Color.magenta); break; case 6: ja.setText("tQuestion : 6nWhat's your opinion on social media like twitter or facebook >>"); jrb[2]=new JRadioButton("Useful"); jrb[1]=new JRadioButton("Waste of time"); jrb[0]=new JRadioButton("Essential"); jrb[3]=new JRadioButton("Confused"); jf.getContentPane().setBackground(Color.pink); break; case 7: ja.setText("tQuestion : 7nWhat'll be your opinion on Smart phones>>"); jrb[2]=new JRadioButton("Useful"); jrb[0]=new JRadioButton("Necessary"); jrb[3]=new JRadioButton("Confusing"); jrb[1]=new JRadioButton("Expensive");
  • 20. PAGE 19 jf.getContentPane().setBackground(Color.orange); break; case 8: ja.setText("tQuestion : 8nHow would you like to celebrate your Birthday>>"); jrb[3]=new JRadioButton("It's for kids"); jrb[1]=new JRadioButton("Meal with family"); jrb[2]=new JRadioButton("Partying & Drinking"); jrb[0]=new JRadioButton("Birthday games & cakes"); jf.getContentPane().setBackground(Color.red); break; case 9: ja.setText("tQuestion : 9nWhat's your opinion on classical music>>"); jrb[1]=new JRadioButton("Relaxing"); jrb[0]=new JRadioButton("Hate it"); jrb[3]=new JRadioButton("Love it"); jrb[2]=new JRadioButton("It's okay"); jf.getContentPane().setBackground(Color.green); break;
  • 21. PAGE 20 case 10: ja.setText("tQuestion : 10nWhat would your ideal vacation consist of>>"); jrb[0]=new JRadioButton("Going to theme Park like DisneyLand"); jrb[1]=new JRadioButton("Beach / Hawaii / Spain"); jrb[2]=new JRadioButton("Touring : Italy / New York"); jrb[3]=new JRadioButton("Experiencing new cultures"); jf.getContentPane().setBackground(Color.cyan); break; } jrb[0].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent be) { sum=sum+40; } }); jrb[1].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent be) { sum=sum+20;
  • 22. PAGE 21 } }); jrb[2].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent be) { sum=sum+30; } }); jrb[3].addActionListener(new ActionListener() { public void actionPerformed(ActionEvent be) { sum=sum+10; } }); next.setBounds(400,50,100,20); next.setToolTipText("Next Question"); next.setFont(new Font("Serif",Font.ITALIC,40)); next.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) {jif.dispose();
  • 23. PAGE 22 if(count==10) { System.out.println("sum = "+sum+" count = "+count); addcomment(sum); } start(); } }); jp1.add(jsp1); for(int i=0;i<4;i++) { jrb[i].setFont(new Font("Segoe Script",Font.ITALIC+Font.BOLD,30)); bg.add(jrb[i]); jp1.add(jrb[i]); } jp1.add(next);
  • 24. PAGE 23 jif=new JInternalFrame("Here's the game!!"); jif.setBounds(330,40,320,260); jif.setIconifiable(true); jif.setSize(800,600); jif.setResizable(true); jif.setVisible(true); jif.add(jp1); dsp.add(jif); jf.add(dsp); jf.setContentPane(dsp); dsp.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); public void addcomment(int score) { if(score>=350&&score<=400) comment="your mental age is between 4 to 9 years.nWith a childish nature,you can find joy,namusement from simplest of things."; else if(score>=300&&score<=340)
  • 25. PAGE 24 comment="you have a teenager's mind ie in between 9 to 16.nFairly immature & can sometimes rebel against the normal one's.nYou're a quirky character"; else if(score>=250&&score<=290) comment="your mental age is between 16 to 21 years.nYou know when to act maturely but also knows how to have fun.nYou can act immature & seriously whenever you see fit"; else if(score>=200&&score<=240) comment="your mental age is between 21 to 29 years.nYou've a young adult's mind acting mature most of the time & knows nwhen to be serious.Intelligent & self aware."; else if(score>=150&&score<=190) comment="your mental age is between 29 to 55 years.nYou are a mature adult.Modest & noble with good manners.nEqually good etiquette.You have all the properties to become a Connoisseur"; else if(score>=100&&score<=140) comment="your mental age is above 55,man that's old .nYou appreciate simple things & nare not bothered with your environment being modern. "; else comment="Maybe next time";
  • 26. PAGE 25 JTextField jj=new JTextField(); done=new JButton("Done "); submit=new JButton("SUBMIT"); jp1=new JPanel(new GridLayout(4,1,1,1)); jsp1=new JScrollPane(jj); jsp1.setBounds(100,400,300,80); jj.setBounds(100,400,300,80); jj.setFont(new Font("serif",Font.ITALIC,40)); jn.setFont(new Font("serif",Font.BOLD+Font.ITALIC,30)); submit.setFont(new Font("vandana",Font.ITALIC+Font.BOLD,28)); submit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { name=jj.getText(); jif.dispose(); System.out.println(name); show(); //return; } }); jp1.add(jn); jp1.add(jsp1);
  • 27. PAGE 26 jp1.add(submit); jif=new JInternalFrame("Enter your name >>"); jif.setBounds(330,40,320,260); jif.setIconifiable(true); jif.setSize(800,600); jif.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); jif.setVisible(true); jif.add(jp1); dsp.add(jif); jf.add(dsp); jf.setContentPane(dsp); dsp.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); } public void show() { JTextArea jj=new JTextArea(); done=new JButton("Done ");
  • 28. PAGE 27 jp1=new JPanel(new GridLayout(4,1,1,1)); jsp1=new JScrollPane(jj); jsp1.setBounds(100,400,300,80); jj.setBounds(100,400,300,80); jj.setFont(new Font("serif",Font.ITALIC,20)); jn.setFont(new Font("serif",Font.BOLD+Font.ITALIC,30)); jn.setText("Result >>"); jj.setText(" "+name+" ,"+comment); jj.setEditable(false); done.setFont(new Font("vandana",Font.ITALIC,20)); done.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jif.dispose(); jf.dispose(); addrecord(); external(); } }); jp1.add(jn);
  • 29. PAGE 28 jp1.add(jsp1); jp1.add(done); jif=new JInternalFrame("Done !!"); jif.setBounds(330,40,320,260); jif.setIconifiable(true); jif.setSize(800,600); jif.setVisible(true); jif.add(jp1); dsp.add(jif); jf.add(dsp); jf.setContentPane(dsp); dsp.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); } public void addrecord() { open(); try { x.format("%s %d %sn",name,sum,comment);
  • 30. PAGE 29 }catch(Exception e){System.out.println(e);} close(); } public void open() { try {x=new Formatter("records.txt"); }catch(Exception e){System.out.println(e);} } public void close() { try {x.close(); }catch(Exception e){System.out.println(e);} } public void records() { jf.getContentPane().setBackground(Color.blue); JTextArea jj=new JTextArea(""); jj.setLineWrap(true); jsp2=new JScrollPane(jj); jp1=new JPanel(new GridLayout(2,1,1,1)); jp1.setBounds(100,400,100,50); jp1.setOpaque(true); JButton bm=new JButton("<< Back to Menu"); bm.setBounds(100,400,100,50);
  • 31. PAGE 30 bm.setToolTipText("Back to Main Menu"); bm.setFont(new Font("Serif",Font.ITALIC,30)); bm.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jif.dispose(); jf.dispose(); external(); } }); try { x1=new Scanner(new File("records.txt")); while(x1.hasNextLine()) { String Line=x1.nextLine(); jj.append(Line); } } catch(Exception e){System.out.println(e);} jsp2.setBounds(0,0,100,150); jj.setBounds(0,0,800,300);
  • 32. PAGE 31 jj.setFont(new Font("Segoe Script",Font.BOLD,30)); jj.setEditable(false); jif=new JInternalFrame("Here's the game!!"); jif.setBounds(330,40,400,300); jif.setIconifiable(true); jif.setSize(800,600); jif.setVisible(true); jp1.add(jsp2); jp1.add(bm); jif.add(jp1); dsp.add(jif); jf.add(dsp); jf.setContentPane(dsp); dsp.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); } public void help() { JTextArea jj=new JTextArea(); jsp2=new JScrollPane(jj); jp1=new JPanel(new GridLayout(2,1,1,1)); JButton bm=new JButton("<< Back to Menu");
  • 33. PAGE 32 bm.setBounds(100,100,10,10); bm.setToolTipText("Back to Main Menu"); bm.setFont(new Font("Serif",Font.ITALIC,30)); bm.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jif.dispose(); jf.dispose(); external(); } }); jsp2.setBounds(0,0,600,150); jj.setEditable(false); jj.setBounds(0,0,400,150); jj.setFont(new Font("serif",Font.PLAIN,18)); jj.setText("t>>~~HELP MENU~~n=>>You must be aware of your age.n=>>But that's the age of your body ,a physical entity.n=>>This is a game to calculate your mental age.n=>>The age of your mind or so to speak ,the maturity of your mind,that has nothing to do with the physical nage in most cases. n=>>Here you'll be facing 10 Questions with 4 choices,each of them is assigned a certain amount.n=>>Depending on what option you choose a certain amount is added to your score.n=>>Minimum amount is 10 & maximum is 40.n=>>At the end of the game: nYour mental age with a comment will be displayed.");
  • 34. PAGE 33 jif=new JInternalFrame("Here you go"); jif.setBounds(330,40,400,300); jif.setIconifiable(true); jif.setSize(800,600); jif.setVisible(true); jp1.add(jsp2); jp1.add(bm); jif.add(jp1); dsp.add(jif); jf.add(dsp); jf.setContentPane(dsp); dsp.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); } public void exit() { jf.dispose(); return ; }
  • 35. PAGE 34 public void info() { JTextArea jj=new JTextArea(); jsp2=new JScrollPane(jj); jp1=new JPanel(new GridLayout(2,1,1,1)); JButton bm=new JButton("<< Back to Menu"); bm.setBounds(100,100,10,10); bm.setToolTipText("Back to Main Menu"); bm.setFont(new Font("Serif",Font.ITALIC,30)); bm.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jif.dispose(); jf.dispose(); external(); } }); jsp2.setBounds(0,0,600,150); jj.setEditable(false); jj.setBounds(0,0,400,150); jj.setFont(new Font("segoe script",Font.PLAIN,20));
  • 36. PAGE 35 jj.setText("ntMental Age CalculatornCreated by:tVarunntBTCSE 15013089ntCSE Batch-2ndnStudent of: tGURU JAMBHESHWAR UNIVERISTY OF ntSCIENCE & TECHNOLOGY"); jj.append("nEmail id: [email protected] in:t2015"); jif=new JInternalFrame("Here you go"); jif.setBounds(330,40,400,300); jif.setIconifiable(true); jif.setSize(800,600); jif.setVisible(true); jp1.add(jsp2); jp1.add(bm); jif.add(jp1); dsp.add(jif); jf.add(dsp); jf.setContentPane(dsp); dsp.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); } public void how() { JTextArea jj=new JTextArea();
  • 37. PAGE 36 jsp2=new JScrollPane(jj); jp1=new JPanel(new GridLayout(2,1,1,1)); JButton bm=new JButton("<< Back to Menu"); bm.setBounds(100,100,10,10); bm.setToolTipText("Back to Main Menu"); bm.setFont(new Font("Segoe script",Font.ITALIC,30)); bm.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { jif.dispose(); jf.dispose(); external(); } }); jsp2.setBounds(0,0,600,150); jj.setEditable(false); jj.setBounds(0,0,400,150); jj.setFont(new Font("serif",Font.PLAIN,20)); jj.setText("ntEvery person around us has their own way of thinking.nA person with the age of an average adult may not act like an
  • 38. PAGE 37 adult whereas a child at the age of 10 nmight actually behave like one.ntThe thing is our mind grows different than our bodies.According to the choices our nmind makes for us,an age group can be deduced for our mind.In this game you'll be facing 10 nquestions,according to the choices you make ,an age group is narrowed & will be shown as yourn result.Choose carefully! "); jif=new JInternalFrame("the idea"); jif.setBounds(330,40,400,300); jif.setIconifiable(true); jif.setSize(800,600); jif.setVisible(true); jp1.add(jsp2); jp1.add(bm); jif.add(jp1); dsp.add(jif); jf.add(dsp); jf.setContentPane(dsp); dsp.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); }
  • 39. PAGE 38 public static void main(String args[]) { mind3 m=new mind3(); m.external(); } }
  • 44. PAGE 43 HELP Menu :- Previous Player’s result :-
  • 46. PAGE 45 6.Further Development Despite being quite accurate this idea still needs to meet with innovation.It has the continuovs need of updated information for changing generation to judge people’s choices.Further scope of it’s development would be to merge it with an Artificial Intellligent system which can interact with people,provide response,humour them, read their choices & do more stuff. By collecting data on a single person per database It can be true to the mark when there is a need to judge it’s owner’s character. Hence the project to calculate one’s mental age is complete.