Hi this is a decompiled version of a guessing game which i am required to submit in assignment. can anyone please make it run anyhow. i hav also attached sample from which i generated code any help will be appreciated. Thanks

// Decompiled by DJ v3.11.11.95 Copyright 2009 Atanas Neshkov  Date: 2/09/2009 5:40:48 PM
// Home Page: http://members.fortunecity.com/neshkov/dj.html http://www.neshkov.com/dj.html - Check often for new version!
// Decompiler options: packimports(3) 
// Source File Name:   GuessingGame.java

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;
import javax.swing.*;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;

public class GuessingGame extends JFrame
{

    public GuessingGame()
    {
        credit = 20;
        yourOptionValue = 0;
        computerChoice = 0;
        outputMessage = "";
        higherOrLower = "";
        computerChoice = generateNumber();
        JMenuBar jmenubar = new JMenuBar();
        setJMenuBar(jmenubar);
        jmenubar.add(createFileMenu());
        jmenubar.add(createHelpMenu());
        JPanel jpanel = createLeftPanel();
        JPanel jpanel1 = createRightPanel();
        JPanel jpanel2 = new JPanel();
        jpanel2.setLayout(new GridLayout(1, 2));
        jpanel2.setBorder(new TitledBorder(new EtchedBorder(), ""));
        jpanel2.add(jpanel);
        jpanel2.add(jpanel1);
        add(jpanel2);
    }

    public JMenu createFileMenu()
    {
        JMenu jmenu = new JMenu("File");
        jmenu.add(createExitItem());
        return jmenu;
    }

    public JMenuItem createExitItem()
    {
        JMenuItem jmenuitem = new JMenuItem("Exit");
        class _cls1MenuItemListener
            implements ActionListener
        {

            public void actionPerformed(ActionEvent actionevent)
            {
                if(JOptionPane.showConfirmDialog(null, "DO YOU REALLY WANT TO EXIT??", "", 0, 2) == 0)
                    System.exit(0);
            }

            final GuessingGame this$0;

            _cls1MenuItemListener()
            {
                this$0 = GuessingGame.this;
                super();
            }
        }

        _cls1MenuItemListener _lcls1menuitemlistener = new _cls1MenuItemListener();
        jmenuitem.addActionListener(_lcls1menuitemlistener);
        return jmenuitem;
    }

    public JMenu createHelpMenu()
    {
        JMenu jmenu = new JMenu("Help");
        jmenu.add(createAboutItem());
        return jmenu;
    }

    public JMenuItem createAboutItem()
    {
        JMenuItem jmenuitem = new JMenuItem("About");
        class _cls2MenuItemListener
            implements ActionListener
        {

            public void actionPerformed(ActionEvent actionevent)
            {
                JOptionPane.showMessageDialog(null, "Input a number between 0-20 in the Lucky Guess Area, press Start button.");
            }

            final GuessingGame this$0;

            _cls2MenuItemListener()
            {
                this$0 = GuessingGame.this;
                super();
            }
        }

        _cls2MenuItemListener _lcls2menuitemlistener = new _cls2MenuItemListener();
        jmenuitem.addActionListener(_lcls2menuitemlistener);
        return jmenuitem;
    }

    public JPanel createLeftPanel()
    {
        textArea = new JTextArea(25, 30);
        JScrollPane jscrollpane = new JScrollPane(textArea);
        textArea.setText("");
        textArea.setEditable(false);
        JPanel jpanel = new JPanel();
        jpanel.add(jscrollpane);
        jpanel.setBorder(new TitledBorder(new EtchedBorder(), "Output Message area"));
        return jpanel;
    }

    public JPanel createRightPanel()
    {
        JPanel jpanel = new JPanel(new GridLayout(1, 1));
        jpanel.setBorder(new TitledBorder(new EtchedBorder(), "Credit Point Area"));
        creditLabel = new JLabel((new StringBuilder()).append("Your Current Credit:   ").append(credit).toString());
        jpanel.add(creditLabel);
        JPanel jpanel1 = createCoinPanel();
        JPanel jpanel2 = createInputPanel();
        JPanel jpanel3 = createFunctionPanel();
        JPanel jpanel4 = new JPanel(new GridLayout(4, 1));
        jpanel4.add(jpanel);
        jpanel4.add(jpanel1);
        jpanel4.add(jpanel2);
        jpanel4.add(jpanel3);
        return jpanel4;
    }

    public JPanel createCoinPanel()
    {
        JPanel jpanel = new JPanel(new GridLayout(1, 2));
        jpanel.setBorder(new TitledBorder(new EtchedBorder(), "Insert Coin"));
        oneDollar = new JRadioButton("$1");
        twoDollar = new JRadioButton("$2");
        oneDollar.setEnabled(false);
        twoDollar.setEnabled(false);
        ButtonGroup buttongroup = new ButtonGroup();
        buttongroup.add(oneDollar);
        buttongroup.add(twoDollar);
        class _cls1CoinListener
            implements ActionListener
        {

            public void actionPerformed(ActionEvent actionevent)
            {
                String s = actionevent.getActionCommand();
                if(s.equals("$1"))
                    credit = credit + 10;
                if(s.equals("$2"))
                    credit = credit + 20;
                creditLabel.setText((new StringBuilder()).append("Your Current Credit:   ").append(credit).toString());
                setGameEnabled(true);
                setMoneyEnabled(false);
            }

            final GuessingGame this$0;

            _cls1CoinListener()
            {
                this$0 = GuessingGame.this;
                super();
            }
        }

        _cls1CoinListener _lcls1coinlistener = new _cls1CoinListener();
        oneDollar.addActionListener(_lcls1coinlistener);
        twoDollar.addActionListener(_lcls1coinlistener);
        jpanel.add(oneDollar);
        jpanel.add(twoDollar);
        return jpanel;
    }

    public JPanel createInputPanel()
    {
        JPanel jpanel = new JPanel(new GridLayout(2, 1));
        jpanel.setBorder(new TitledBorder(new EtchedBorder(), "Lucky Guess Area"));
        JLabel jlabel = new JLabel("Enter a number from 0 to 20 then press Start");
        guessTextField = new JTextField(3);
        guessTextField.setEditable(true);
        jpanel.add(jlabel);
        jpanel.add(guessTextField);
        return jpanel;
    }

    public JPanel createFunctionPanel()
    {
        JPanel jpanel = new JPanel(new GridLayout(1, 2));
        jpanel.setBorder(new TitledBorder(new EtchedBorder(), "Function Panel"));
        start = new JButton("START");
        reset = new JButton("RESET");
        class _cls1FunctionListener
            implements ActionListener
        {

            public void actionPerformed(ActionEvent actionevent)
            {
                String s = actionevent.getActionCommand();
                String s1 = "Yes";
                if(s.equals("RESET"))
                    reset();
                if(s.equals("START"))
                {
                    try
                    {
                        yourOptionValue = Integer.parseInt(guessTextField.getText());
                    }
                    catch(NumberFormatException numberformatexception)
                    {
                        JOptionPane.showMessageDialog(null, "Please enter an integer value in the field!");
                        guessTextField.setText("");
                        s1 = "No";
                    }
                    if(yourOptionValue < 0 || yourOptionValue > 20)
                    {
                        JOptionPane.showMessageDialog(null, "Please enter an integer between 0-20!");
                        guessTextField.setText("");
                        s1 = "No";
                    }
                    if(s1 == "Yes")
                    {
                        int i = getCreditEarn(yourOptionValue, computerChoice);
                        credit = credit + i;
                        outputMessage = (new StringBuilder()).append(outputMessage).append("You guessed:  ").append(yourOptionValue).append("\tComputer guessed:  ").append(getHigherOrLower(yourOptionValue, computerChoice)).append("\n").toString();
                        textArea.setText(outputMessage);
                        creditLabel.setText((new StringBuilder()).append("Your Current Credit:   ").append(credit).toString());
                    }
                    if(credit < 10)
                    {
                        JOptionPane.showMessageDialog(null, "You'v lost, insert coin to continue");
                        setGameEnabled(false);
                        setMoneyEnabled(true);
                    }
                    if(credit >= 50)
                    {
                        JOptionPane.showMessageDialog(null, "You won!!");
                        reset();
                    }
                }
            }

            final GuessingGame this$0;

            _cls1FunctionListener()
            {
                this$0 = GuessingGame.this;
                super();
            }
        }

        _cls1FunctionListener _lcls1functionlistener = new _cls1FunctionListener();
        start.addActionListener(_lcls1functionlistener);
        reset.addActionListener(_lcls1functionlistener);
        jpanel.add(start);
        jpanel.add(reset);
        return jpanel;
    }

    public int getCreditEarn(int i, int j)
    {
        int k = 0;
        if(i > j || i < j)
            k -= 2;
        else
            k += 50;
        return k;
    }

    public String getHigherOrLower(int i, int j)
    {
        if(i > j)
            return "Lower";
        if(i < j)
            return "Higher";
        else
            return "Same";
    }

    public void reset()
    {
        computerChoice = generateNumber();
        yourOptionValue = 0;
        credit = 20;
        outputMessage = "";
        textArea.setText("");
        creditLabel.setText((new StringBuilder()).append("Your Current Credit:   ").append(credit).toString());
        guessTextField.setText("");
        setGameEnabled(true);
        setMoneyEnabled(false);
    }

    public void setGameEnabled(boolean flag)
    {
        start.setEnabled(flag);
    }

    public void setMoneyEnabled(boolean flag)
    {
        oneDollar.setEnabled(flag);
        twoDollar.setEnabled(flag);
    }

    public int generateNumber()
    {
        Random random = new Random();
        return 1 + random.nextInt(20);
    }

    public static void main(String args[])
    {
        GuessingGame guessinggame = new GuessingGame();
        guessinggame.setDefaultCloseOperation(3);
        guessinggame.setSize(700, 500);
        Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
        int i = dimension.width;
        int j = dimension.height;
        int k = (i - guessinggame.getWidth()) / 2;
        int l = (j - guessinggame.getHeight()) / 2;
        guessinggame.setLocation(k, l);
        guessinggame.setVisible(true);
        guessinggame.setResizable(false);
    }

    private int credit;
    private int yourOptionValue;
    private int computerChoice;
    private String outputMessage;
    private String higherOrLower;
    private JTextArea textArea;
    private JLabel creditLabel;
    private JRadioButton oneDollar;
    private JRadioButton twoDollar;
    private JTextField guessTextField;
    private JButton start;
    private JButton reset;
    private static final int FRAME_WIDTH = 700;
    private static final int FRAME_HEIGHT = 500;










}

I got errors and i solved them now my code is working perfectly but i have to make a lot of changes so that it doesnt look as if i have used decompiled version of sample provided to make assignment. my new code is as follows:

/*

Tejas Thacker
Assignment1 GussingGame.java

*/

import java.awt.*;
import java.awt.event.*;
import java.util.Random;
import javax.swing.*;
import javax.swing.border.EtchedBorder;
import javax.swing.border.TitledBorder;

public class GuessingGame extends JFrame
{
	private int creditValue;
	private int guess;
	private int randomNumber;
	private String outputMessage;
	private String guessResult;
	private JTextArea guessResultArea;
	private JLabel creditValueLabel;
	private JRadioButton dollar1;
	private JRadioButton dollar2;
	private JTextField guessTextField;
	private JButton startButton;
	private JButton resetButton;


    public GuessingGame()
    {

		super( "Guessing Game" );

        creditValue = 20;
        guess = 0;
        randomNumber = 0;
        outputMessage = "";
        guessResult = "";
        randomNumber = generateNumber();
        JMenuBar jmenubar = new JMenuBar();
        setJMenuBar(jmenubar);
        jmenubar.add(fileMenu());
        jmenubar.add(helpMenu());
        JPanel panel = leftPanel();
        JPanel panel1 = rightPanel();
        JPanel panel2 = new JPanel();
        panel2.setLayout(new GridLayout(1, 2));
        panel2.setBorder(new TitledBorder(new EtchedBorder(), ""));
        panel2.add(panel);
        panel2.add(panel1);
        add(panel2);
    }

    public JMenu fileMenu()
    {
        JMenu jmenu = new JMenu("File");
        jmenu.add(createExitItem());
        return jmenu;
    }

    public JMenuItem createExitItem()
    {
        JMenuItem jmenuitem = new JMenuItem("Exit");
        class MenuItemListener implements ActionListener
        {

            public void actionPerformed(ActionEvent actionevent)
            {
                if(JOptionPane.showConfirmDialog(null, "Do you really want to exit?") == 0)
                    System.exit(0);
            }


        }

        MenuItemListener menuitemlistener = new MenuItemListener();
        jmenuitem.addActionListener(menuitemlistener);
        return jmenuitem;
    }

    public JMenu helpMenu()
    {
        JMenu jmenu = new JMenu("Help");
        jmenu.add(createAboutItem());
        return jmenu;
    }

    public JMenuItem createAboutItem()
    {
        JMenuItem jmenuitem = new JMenuItem("About");
        class _cls2MenuItemListener
            implements ActionListener
        {

            public void actionPerformed(ActionEvent actionevent)
            {
                JOptionPane.showMessageDialog(null, "Input a number between 0-20 in the Lucky Guess Area, press Start button.");
            }

            final GuessingGame this$0;

            _cls2MenuItemListener()
            {
                this$0 = GuessingGame.this;

            }
        }

        _cls2MenuItemListener _lcls2menuitemlistener = new _cls2MenuItemListener();
        jmenuitem.addActionListener(_lcls2menuitemlistener);
        return jmenuitem;
    }

    public JPanel leftPanel()
    {
        guessResultArea = new JTextArea(25, 30);
        JScrollPane jscrollpane = new JScrollPane(guessResultArea);
        guessResultArea.setText("");
        guessResultArea.setEditable(false);
        JPanel panel = new JPanel();
        panel.add(jscrollpane);
        panel.setBorder(new TitledBorder(new EtchedBorder(), "Output Message area"));
        return panel;
    }

    public JPanel rightPanel()
    {
        JPanel panel = new JPanel(new GridLayout(1, 1));
        panel.setBorder(new TitledBorder(new EtchedBorder(), "Credit Point Area"));
        creditValueLabel = new JLabel((new StringBuilder()).append("Your Current Credit:   ").append(creditValue).toString());
        panel.add(creditValueLabel);
        JPanel panel1 = createCoinPanel();
        JPanel panel2 = createInputPanel();
        JPanel panel3 = createFunctionPanel();
        JPanel panel4 = new JPanel(new GridLayout(4, 1));
        panel4.add(panel);
        panel4.add(panel1);
        panel4.add(panel2);
        panel4.add(panel3);
        return panel4;
    }

    public JPanel createCoinPanel()
    {
        JPanel panel = new JPanel(new GridLayout(1, 2));
        panel.setBorder(new TitledBorder(new EtchedBorder(), "Insert Coin"));
        dollar1 = new JRadioButton("$1");
        dollar2 = new JRadioButton("$2");
        dollar1.setEnabled(false);
        dollar2.setEnabled(false);
        ButtonGroup buttongroup = new ButtonGroup();
        buttongroup.add(dollar1);
        buttongroup.add(dollar2);
        class _cls1CoinListener
            implements ActionListener
        {

            public void actionPerformed(ActionEvent actionevent)
            {
                String s = actionevent.getActionCommand();
                if(s.equals("$1"))
                    creditValue = creditValue + 10;
                if(s.equals("$2"))
                    creditValue = creditValue + 20;
                creditValueLabel.setText((new StringBuilder()).append("Your Current Credit:   ").append(creditValue).toString());
                setGameEnabled(true);
                setMoneyEnabled(false);
            }

            final GuessingGame this$0;

            _cls1CoinListener()
            {
                this$0 = GuessingGame.this;

            }
        }

        _cls1CoinListener _lcls1coinlistener = new _cls1CoinListener();
        dollar1.addActionListener(_lcls1coinlistener);
        dollar2.addActionListener(_lcls1coinlistener);
        panel.add(dollar1);
        panel.add(dollar2);
        return panel;
    }

    public JPanel createInputPanel()
    {
        JPanel panel = new JPanel(new GridLayout(2, 1));
        panel.setBorder(new TitledBorder(new EtchedBorder(), "Lucky Guess Area"));
        JLabel jlabel = new JLabel("Enter a number from 0 to 20 then press Start");
        guessTextField = new JTextField(3);
        guessTextField.setEditable(true);
        panel.add(jlabel);
        panel.add(guessTextField);
        return panel;
    }

    public JPanel createFunctionPanel()
    {
        JPanel panel = new JPanel(new GridLayout(1, 2));
        panel.setBorder(new TitledBorder(new EtchedBorder(), "Function Panel"));
        startButton = new JButton("START");
        resetButton = new JButton("RESET");
        class _cls1FunctionListener
            implements ActionListener
        {

            public void actionPerformed(ActionEvent actionevent)
            {
                String s = actionevent.getActionCommand();
                String s1 = "Yes";
                if(s.equals("RESET"))
                    resetButton();
                if(s.equals("START"))
                {
                    try
                    {
                        guess = Integer.parseInt(guessTextField.getText());
                    }
                    catch(NumberFormatException numberformatexception)
                    {
                        JOptionPane.showMessageDialog(null, "Please enter an integer value in the field!");
                        guessTextField.setText("");
                        s1 = "No";
                    }
                    if(guess < 0 || guess > 20)
                    {
                        JOptionPane.showMessageDialog(null, "Please enter an integer between 0-20!");
                        guessTextField.setText("");
                        s1 = "No";
                    }
                    if(s1 == "Yes")
                    {
                        int i = getCreditEarn(guess, randomNumber);
                        creditValue = creditValue + i;
                        outputMessage = (new StringBuilder()).append(outputMessage).append("You guessed:  ").append(guess).append("\tComputer guessed:  ").append(getHigherOrLower(guess, randomNumber)).append("\n").toString();
                        guessResultArea.setText(outputMessage);
                        creditValueLabel.setText((new StringBuilder()).append("Your Current Credit:   ").append(creditValue).toString());
                    }
                    if(creditValue < 10)
                    {
                        JOptionPane.showMessageDialog(null, "You'v lost, insert coin to continue");
                        setGameEnabled(false);
                        setMoneyEnabled(true);
                    }
                    if(creditValue >= 50)
                    {
                        JOptionPane.showMessageDialog(null, "You won!!");
                        resetButton();
                    }
                }
            }

            final GuessingGame this$0;

            _cls1FunctionListener()
            {
                this$0 = GuessingGame.this;

            }
        }

        _cls1FunctionListener _lcls1functionlistener = new _cls1FunctionListener();
        startButton.addActionListener(_lcls1functionlistener);
        resetButton.addActionListener(_lcls1functionlistener);
        panel.add(startButton);
        panel.add(resetButton);
        return panel;
    }

    public int getCreditEarn(int i, int j)
    {
        int k = 0;
        if(i > j || i < j)
            k -= 2;
        else
            k += 50;
        return k;
    }

    public String getHigherOrLower(int i, int j)
    {
        if(i > j)
            return "Lower";
        if(i < j)
            return "Higher";
        else
            return "Same";
    }

    public void resetButton()
    {
        randomNumber = generateNumber();
        guess = 0;
        creditValue = 20;
        outputMessage = "";
        guessResultArea.setText("");
        creditValueLabel.setText((new StringBuilder()).append("Your Current Credit:   ").append(creditValue).toString());
        guessTextField.setText("");
        setGameEnabled(true);
        setMoneyEnabled(false);
    }

    public void setGameEnabled(boolean flag)
    {
        startButton.setEnabled(flag);
    }

    public void setMoneyEnabled(boolean flag)
    {
        dollar1.setEnabled(flag);
        dollar2.setEnabled(flag);
    }

    public int generateNumber()
    {
        Random random = new Random();
        return 1 + random.nextInt(20);
    }

    public static void main(String args[])
    {
        GuessingGame guessinggame = new GuessingGame();
        guessinggame.setDefaultCloseOperation(3);
        guessinggame.setSize(700, 500);
        Dimension dimension = Toolkit.getDefaultToolkit().getScreenSize();
        int i = dimension.width;
        int j = dimension.height;
        int k = (i - guessinggame.getWidth()) / 2;
        int l = (j - guessinggame.getHeight()) / 2;
        guessinggame.setLocation(k, l);
        guessinggame.setVisible(true);
        guessinggame.setResizable(false);
    }











}
Comments
Cheater.
You have a lot of nerve asking this

can anyone please make changes and comment my code if u are good at it. that will be really a great help. Thanks again

can anyone please make changes and comment my code if u are good at it. that will be really a great help. Thanks again

if u are good at it

Yes, we are good at it

What does this suppose to mean? Have you any idea what you are asking. It's not enough that you cheated at your assignment, you have the nerve to tell us that you cheated and still ask for help. Help not for the code but how to help you cheat better!!

can anyone please make changes and comment my code

It is not your code.

Comments
Good points.

OK, congrats, you got your code running.

Will you please mark it as solved?
That'll be of great help. Thanks

Why mark it as solved? He didn't solve anything, he just posted the code and asked for help.
And why will it be a great help if it is marked as solved? Why do you want it marked as solved?
How will that help you?

javaAddict,
if a problem is marked as solved I don't normally look at it anymore. It's helpfull because I can look at other problems instead.
True, perhaps I was being selfish and should have phrase it in another way, so there it goes:
"tejasthacker if you got an answer, please mark the thread as solved".
Better now?

javaAddict,
if a problem is marked as solved I don't normally look at it anymore. It's helpfull because I can look at other problems instead.
True, perhaps I was being selfish and should have phrase it in another way, so there it goes:
"tejasthacker if you got an answer, please mark the thread as solved".
Better now?

I am sorry then

Yes, we are good at it

What does this suppose to mean? Have you any idea what you are asking. It's not enough that you cheated at your assignment, you have the nerve to tell us that you cheated and still ask for help. Help not for the code but how to help you cheat better!!


It is not your code.

Yep, cheater.

http://studentoffortune.com/question/160919/Java-people-I-need-instant-help-URGENT

Neg. rep for that. On the plus side, he did use code tags on his first post.

This article has been dead for over six months. Start a new discussion instead.