breiman's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Members
Active Posts:
34 (0.04 per day)
Joined:
28-February 12
Profile Views:
333
Last Active:
User is offline Sep 20 2013 12:45 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   breiman has not set their status

Posts I've Made

  1. In Topic: Java Scheduling program

    Posted 23 Oct 2012

    View Postpbl, on 23 October 2012 - 10:59 AM, said:

    OK so
    (0,3,3) makes 3 - 0 = 3

    but with(1,4,2) 4 - 1 does not = 2

    the first integer in the series is the time you start the job.
    the second integer in the series is the time you finish the job.
    the third is the amount of money you are paid for the job. You are misunderstanding what the numbers in the series mean.
  2. In Topic: parse string & output stack

    Posted 30 Sep 2012

    here is my current code..at runtime I receive java.lang.NullPointerException at lines 54 & 42

    public class StacksGUI extends JFrame implements ActionListener{
      JLabel inputLabel, outputLabel;
      JButton enterButton, clearButton;
      JTextField inputText, outputText;
      String strInput;
      Stack intStack;
      int strToken;
      char digit;
      StringBuilder sb;
      
      public StacksGUI(){
        setLayout(new FlowLayout());
        
        inputLabel = new JLabel("Positive Integers: ");
        add(inputLabel);
        
        inputText = new JTextField(15);
        add(inputText);
        
        outputLabel = new JLabel(" Integers in reverse: ");
        add(outputLabel);
        
        outputText = new JTextField(15);
        add(outputText);
        
        enterButton = new JButton("Enter");
        add(enterButton);
        
        clearButton = new JButton("Clear Textfields");
        add(clearButton);
        
        inputText.addActionListener(this);
        outputText.addActionListener(this);
        enterButton.addActionListener(this);
        clearButton.addActionListener(this);
      }
        public void actionPerformed(ActionEvent ae) {
    
        strInput = inputText.getText();
        
        if (ae.getSource().equals(enterButton))
          reverse(strInput);
        if (ae.getSource().equals(clearButton))
          clearText();
        
        }
        void clearText(){
          inputText.setText("");
          outputText.setText("");
        }
        void reverse(String strInput){
          for(int i = 0; i < strInput.length(); i++){
            digit = strInput.charAt(i);
            intStack.push(digit - '0');
          }
          while(!intStack.isEmpty()){
          sb.append(intStack.pop());
          }
          outputText.setText(sb.toString());
          
        }
        public static void main(String[] args) {
        StacksGUI stack = new StacksGUI();
        stack.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        stack.setLocationByPlatform(true);
        stack.setSize(220, 400);
        stack.setVisible(true);
      }
    }
    
    
  3. In Topic: parse string & output stack

    Posted 29 Sep 2012

    Thank you! do you have any suggestion for printing the stack to the JTextField
  4. In Topic: parse string & output stack

    Posted 29 Sep 2012

    Thank you for your suggestions. They were very helpful but the strInput is a string of integers so I do not want to use the char digit = strInput.charAt(i). I need an alternative for that in terms of integers
  5. In Topic: Coding revisions & get methods

    Posted 25 Sep 2012

    CasiOo, I do not understand your suggestion. I realize you are challenging me to come up with a solution but I do not believe I am able to do so. Thanks to all of you for the help thus far

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

breiman hasn't added any friends yet.

Comments

breiman has no profile comments yet. Why not say hello?