Results 1 to 20 of 21
Thread: balloon burst source code
- 03-06-2009, 01:12 PM #1
Member
- Join Date
- Mar 2009
- Posts
- 31
- Rep Power
- 0
-
and we wish you loads of luck. Please let us know if your program works well for you.
- 03-07-2009, 04:02 AM #3
Member
- Join Date
- Mar 2009
- Posts
- 31
- Rep Power
- 0
k but how do i start pls help me if give a sample then i proceed
-
1) You may wish to give a description of just what you are trying to do, what exactly a "balloon burst" program is, what your specific requirements are. Most of us cannot read minds and your posts are surprisingly devoid of any and all detail.
2) You may wish to show us what you have done so far to complete this project. What code have you created? What program structure are you contemplating?
A great resource that has helped me and will probably help you is an article entitled How To Ask Questions The Smart Way. It will tell you how to formulate your questions so that the folks here will be better able to answer them. Good luck.
- 03-07-2009, 04:44 AM #5
Member
- Join Date
- Mar 2009
- Posts
- 31
- Rep Power
- 0
balloon burst
:confused:A software version of a Balloon-Burst game is required. Several balloons are available to be burst. The number of balloons can be input by the user at the start of the game, or you decide in the program design to fix the number of balloons. At the start of the game a visual representation of the balloons is displayed. You can design the interface using GUI components and design the layout as you wish, using a variety of Java components. You can decide how to represent the balloons and what colours they should be.
Two players take it in turns to burst one or two balloons per go. The person who bursts the last balloon wins. The user interface should allow users to input their number of balloons to burst, and a check should be made so that the number is valid (i.e. 1 or 2). It is up you to decide which balloons are burst: maybe the user can select the balloons using mouse interaction, or maybe your program selects the balloons.
Once a balloon has been selected, its representation on the GUI must change. It will not be possible to select that balloon again. If there is more than one balloon remaining, the next player has a turn. If only one balloon remains, the player whose turn it is should be declared the winner.
The software game must be able to save its current state to disk and be re-opened at a later date. The game files should have the extension .bbg. It is suggested that saving and loading game status if done using buttons or menu items.
-
OK, so we know the requirements. Now what have you done, and what specific question do you have? And again, please read the link in my post above. If you read it, it will help you here, promise.
- 03-07-2009, 05:58 AM #7
Member
- Join Date
- Mar 2009
- Posts
- 31
- Rep Power
- 0
k thanq u for coopertion
- 03-29-2009, 11:24 PM #8
Member
- Join Date
- Mar 2009
- Posts
- 7
- Rep Power
- 0
hi everyone, could anyone please help me out in the code for balloon burst game...I too need the same code.
thank u..
-
Um,... have you read the conversation above? Could you please show at least a little bit of effort? Is that asking too much?
- 03-29-2009, 11:45 PM #10
Member
- Join Date
- Mar 2009
- Posts
- 7
- Rep Power
- 0
Here is my effort mate....
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Vector;
import java.lang.*;
public class balloon extends JPanel
{
JButton btn1;
JMenuBar mnubr;
JMenu mnu;
JMenuItem mnu1;
JMenuItem mnu2;
JMenuItem mnu3;
JMenuItem mnu4;
JMenu mnu5;
JMenuItem mnu6;
JPanel pnl1;
JPanel pnl2;
JRadioButton Rd1;
JRadioButton Rd2;
JRadioButton Rd3;
JRadioButton Rd4;
GridLayout gL;
BorderLayout bL;
JLabel lbl1;
JLabel lbl2;
JLabel lbl3,lbl4,lbl5,lbl6,lbl7,lbl8,lbl9,lbl10,lbl11;
BalloonGame bg;
public balloon()
{
btn1 = new JButton("Burst!");
Rd1 = new JRadioButton("Player 1");
Rd2 = new JRadioButton("Player 2");
Rd3 = new JRadioButton("1 Balloon");
Rd4 = new JRadioButton("2 Balloon");
mnubr = new JMenuBar();
mnu = new JMenu("File");
mnu1 = new JMenuItem("New");
mnu2 = new JMenuItem("Open");
mnu3 = new JMenuItem("Save");
mnu4 = new JMenuItem("Exit");
mnu5 = new JMenu("Game");
mnu6 = new JMenuItem("Help");
pnl1 = new JPanel();
pnl2 = new JPanel();
gL = new GridLayout(3,3);
bL = new BorderLayout();
lbl1 = new JLabel("Number of Balloon is:9");
lbl3= new JLabel("balloons");
lbl4= new JLabel("balloons");
lbl5= new JLabel("balloons");
lbl6= new JLabel("balloons");
lbl7= new JLabel("balloons");
lbl8= new JLabel("balloons");
lbl9= new JLabel("balloons");
lbl10= new JLabel("balloons");
lbl11= new JLabel("balloons");
//lbl2 = new JLabel( );
//lbl2.setText(bg.getTotal());
bg = new BalloonGame();
//lbl2=bg.getTotal();
this.setLayout(bL);
pnl1.setLayout(gL);
//Vector <JLabel> balloons= new Vector <JLabel> ();
//for(int i=1; i <= 9; i++)
//{
//
// ImageIcon lbl3 = new ImageIcon("/ybhav1//balloon.jpeg");
// balloons.addElement(lbl3);
//
//lbl3 = new JLabel (balloon);
//}
//else
//{
// balloon1.AddElement() = new JLabel("balloon1");
pnl1.add(lbl3);
pnl1.add(lbl4);
pnl1.add(lbl5);
pnl1.add(lbl6);
pnl1.add(lbl7);
pnl1.add(lbl8);
pnl1.add(lbl9);
pnl1.add(lbl10);
pnl1.add(lbl11);
pnl2.add(Rd1);
pnl2.add(Rd2);
pnl2.add(btn1);
pnl2.add(Rd3);
pnl2.add(Rd4);
pnl2.add(lbl1);
//pnl2.add(lbl2);
mnubr.add(mnu);
mnu.add(mnu1);
mnu.add(mnu2);
mnu.add(mnu3);
mnu.add(mnu4);
mnubr.add(mnu5);
mnu5.add(mnu6);
ImageIcon balloons = new ImageIcon("u:/ybhav1/balloons.jpeg");
lbl3= new JLabel(balloons);
this.add(mnubr,BorderLayout.NORTH);
this.add(pnl1,BorderLayout.CENTER);
this.add(pnl2,BorderLayout.SOUTH);
ButtonGroup group = new ButtonGroup();
group.add(Rd1);
group.add(Rd2);
Rd1.setSelected(true);
ButtonGroup group1 = new ButtonGroup();
group1.add(Rd3);
group1.add(Rd4);
Rd3.setSelected(true);
btn1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
BtnClick(e);}
});
Rd3.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}});
Rd4.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
}});
}
public void Balloon1Burst(ActionEvent e)
{
/* ButtonGroup group = new ButtonGroup();
group.add(Rd3);
group.add(Rd4);
String s = new Integer(bg.getTotal()).toString();
lbl2.setText(s);
// Rd3.setSelected(true);*/
}
public void BtnClick(ActionEvent e)
{
if(Rd3.isSelected() )
{
bg.Burst(1);
String s=new Integer(bg.getTotal()).toString();
lbl1.setText("Balloon Left is:"+s);
}
else
{
bg.Burst(2);
String s=new Integer(bg.getTotal()).toString();
lbl1.setText("Balloon Left is:"+s);
}
}
/*public void Balloon2Burst(ActionEvent e)
{
bg.Burst(2);
String s = new Integer(bg.getTotal()).toString();
//lbl2.setText(s);*/
}
- 03-29-2009, 11:46 PM #11
Member
- Join Date
- Mar 2009
- Posts
- 7
- Rep Power
- 0
I hope u can help me out now, I am also giving u the main method
here is the main method
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class testballoon
{
public static void main(String []args)
{
JFrame application = new JFrame ("Balloon Burst Game"); // title of new main frame
// Create balloon panel object and adds it to memory
balloon panel = new balloon();
application.add(panel);
// configure and show
application.setDefaultCloseOperation(JFrame.EXIT_O N_CLOSE);
application.setSize(600,750); // size of window
application.setVisible(true);
}
} // need every time
- 03-29-2009, 11:47 PM #12
Member
- Join Date
- Mar 2009
- Posts
- 7
- Rep Power
- 0
This is the Balloon Game program,
// BalloonGame.java
// Basic class for balloon game
// 9/3/2008
public class BalloonGame
{
public int total;
// constant
public final int MAXTOTAL = 9;
public final int MINTOTAL = 5;
public final int DEFAULT = 7;
public BalloonGame() // constructor, sets balloons to 0
{
total = 9 ;
}
public BalloonGame(int i) // second constructor, allows user to input total
{
if (i > MINTOTAL && i <= MAXTOTAL) // i.e. can't play game if certain no balloons not in range
{
total = i;
}
else total = DEFAULT; // default. So set rules for the game.
}
public int getTotal() // returns total balloons
{
return total;
}
public void Burst(int b) // sets total after burst balloons. Just a method, doesn't return anything.
{
if (b == 1 && b <= total || b == 2 && b <= total)
{
total = total - b;
if (total == 0)
{
// there are no more balloons to burst
}
}
//total = total;
}
}
- 03-29-2009, 11:48 PM #13
Member
- Join Date
- Mar 2009
- Posts
- 7
- Rep Power
- 0
Please go thru the programs, and let me know if u want to know anything, then I will give u my requirements.... cheers mate, for the reply
-
What's your question regarding this code? What's working, what's not working?
- 03-30-2009, 12:27 AM #15
This isn't "Come-and-get-your-homework-assignments-written-for-you Forums"
-
Sure it is ;), but my hourly rats start at 120 per with 5 hours paid in advance.
- 03-30-2009, 02:42 PM #17
Member
- Join Date
- Mar 2009
- Posts
- 7
- Rep Power
- 0
I do not mind paying u all mate,, the question, I could able to create 9 lables in panel(grid layout), but how to I put images in that labels and how do I make the images burst,, and then how do I save, use throw catch exception handling? how do put action listener to exit, save commands and stuff like that.....
thanks mate
- 04-06-2009, 08:33 PM #18
Member
- Join Date
- Mar 2009
- Posts
- 7
- Rep Power
- 0
Guys I am waiting for ur relpy.. plz guys, and I manged to insert the images and I am able to burst the balloons, now I can burst the eight balloons, but I could not burst the last ballon left out, or the last two balloons which are left out, and also could u all please let me know how to add action listener to the new, open, save and exit,
thnk u all
- 04-21-2009, 12:05 PM #19
Member
- Join Date
- Apr 2009
- Posts
- 2
- Rep Power
- 0
Hi
did u get the code for Ballon burst game
- 04-21-2009, 12:09 PM #20
Member
- Join Date
- Apr 2009
- Posts
- 2
- Rep Power
- 0
Similar Threads
-
wrong source code
By pro85 in forum Java AppletsReplies: 4Last Post: 02-17-2009, 03:46 AM -
MavenJava - browse source code of all open source projects online
By jirkacelak in forum Java SoftwareReplies: 1Last Post: 11-28-2008, 06:27 PM -
Help me out in compiling the source code
By aks.nitw in forum Advanced JavaReplies: 3Last Post: 10-17-2008, 08:33 AM -
source code of 'javac'?
By Pooja Deshpande in forum Advanced JavaReplies: 2Last Post: 06-04-2008, 11:24 AM -
Need a source code
By vissu007 in forum New To JavaReplies: 1Last Post: 07-05-2007, 07:08 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks