Page 1 of 2 12 LastLast
Results 1 to 20 of 21
  1. #1
    satti is offline Member
    Join Date
    Mar 2009
    Posts
    31
    Rep Power
    0

    Default balloon burst source code

    i want a mini project in source code

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    and we wish you loads of luck. Please let us know if your program works well for you.

  3. #3
    satti is offline Member
    Join Date
    Mar 2009
    Posts
    31
    Rep Power
    0

    Default

    k but how do i start pls help me if give a sample then i proceed

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    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.

  5. #5
    satti is offline Member
    Join Date
    Mar 2009
    Posts
    31
    Rep Power
    0

    Default 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.

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    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.

  7. #7
    satti is offline Member
    Join Date
    Mar 2009
    Posts
    31
    Rep Power
    0

    Default

    k thanq u for coopertion

  8. #8
    ybhavsvaibhav is offline Member
    Join Date
    Mar 2009
    Posts
    7
    Rep Power
    0

    Default

    hi everyone, could anyone please help me out in the code for balloon burst game...I too need the same code.
    thank u..

  9. #9
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Um,... have you read the conversation above? Could you please show at least a little bit of effort? Is that asking too much?

  10. #10
    ybhavsvaibhav is offline Member
    Join Date
    Mar 2009
    Posts
    7
    Rep Power
    0

    Default

    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);*/
    }

  11. #11
    ybhavsvaibhav is offline Member
    Join Date
    Mar 2009
    Posts
    7
    Rep Power
    0

    Default

    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

  12. #12
    ybhavsvaibhav is offline Member
    Join Date
    Mar 2009
    Posts
    7
    Rep Power
    0

    Default

    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;

    }
    }

  13. #13
    ybhavsvaibhav is offline Member
    Join Date
    Mar 2009
    Posts
    7
    Rep Power
    0

    Default

    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

  14. #14
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    What's your question regarding this code? What's working, what's not working?

  15. #15
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    This isn't "Come-and-get-your-homework-assignments-written-for-you Forums"

  16. #16
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    Sure it is ;), but my hourly rats start at 120 per with 5 hours paid in advance.

  17. #17
    ybhavsvaibhav is offline Member
    Join Date
    Mar 2009
    Posts
    7
    Rep Power
    0

    Default

    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

  18. #18
    ybhavsvaibhav is offline Member
    Join Date
    Mar 2009
    Posts
    7
    Rep Power
    0

    Default

    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

  19. #19
    sheebalam is offline Member
    Join Date
    Apr 2009
    Posts
    2
    Rep Power
    0

    Default Hi

    did u get the code for Ballon burst game

  20. #20
    sheebalam is offline Member
    Join Date
    Apr 2009
    Posts
    2
    Rep Power
    0

    Default

    Quote Originally Posted by ybhavsvaibhav View Post
    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
    Could u plz send me the Game code as well i have the same req's

Page 1 of 2 12 LastLast

Similar Threads

  1. wrong source code
    By pro85 in forum Java Applets
    Replies: 4
    Last Post: 02-17-2009, 04:46 AM
  2. Replies: 1
    Last Post: 11-28-2008, 07:27 PM
  3. Help me out in compiling the source code
    By aks.nitw in forum Advanced Java
    Replies: 3
    Last Post: 10-17-2008, 09:33 AM
  4. source code of 'javac'?
    By Pooja Deshpande in forum Advanced Java
    Replies: 2
    Last Post: 06-04-2008, 12:24 PM
  5. Need a source code
    By vissu007 in forum New To Java
    Replies: 1
    Last Post: 07-05-2007, 08:08 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •