ric1989's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Restricted Editor
Active Posts:
119 (0.12 per day)
Joined:
28-February 12
Profile Views:
7,724
Last Active:
User is offline Nov 29 2014 05:35 AM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Mac
Favorite Browser:
Safari
Favorite Processor:
Intel
Favorite Gaming Platform:
Playstation
Your Car:
Honda
Dream Kudos:
0

Latest Visitors

Icon   ric1989 online

Posts I've Made

  1. In Topic: PostFix Notation confusion

    Posted 26 Nov 2014

    sorry about that but can i please get an advice about this please?

    my program is suppose to take 2 numbers from my stack created
    when i have 2 3 4 -+
    it drops 3 and 4 as numbers and add them together making it 7 then it drops the 2
    and it would be 7 - 2 which the answer to me will show as 5.
  2. In Topic: PostFix Notation confusion

    Posted 26 Nov 2014

    Basically when i run my class and enter my value as 2 3 5 -/.
    The class runs and calculate 3-5 = -2 and then ignore my division sign?
    so it calculates only my 2 values and ignore the third value i guess and answer is completely off.
    I need advice and suggestions please?

    	StackArray 	stack = new StackArray();
    	StringTokenizer tok;
    	private int val1,val2;
    	private int result;
    	public PostfixEvaluator(String postfix)
    	{
    	tok = new StringTokenizer(postfix);
    		while(tok.hasMoreElements())
    		{
    			String token = tok.nextToken();
    			if(Numeral.isOperand(token))
    			{
    				stack.push(token);
    			}
    			
    			else if (token.equals("a") || token.equals("b") || token.equals("c"))	
    			{
    				JOptionPane.showMessageDialog(null,"Invalid Input","Error",JOptionPane.ERROR_MESSAGE);
    			}
    			else if(Numeral.isOperator(token))
    			{
    				if(token.equals("+"))
    				{
    					val1 = Integer.parseInt(stack.pop().toString());
    					val2 = Integer.parseInt(stack.pop().toString());
    					
    					result = val1 + val2;
    				
    					stack.push(new Integer(result));
    				}
    				else if(token.equals("-"))
    				{
    					val1 = Integer.parseInt(stack.pop().toString());
    					val2 = Integer.parseInt(stack.pop().toString());
    					result = val2 - val1;
    					stack.push(new Integer(result));
    				}
    				else if(token.equals("*"))
    				{
    					val1 = Integer.parseInt(stack.pop().toString());
    					val2 = Integer.parseInt(stack.pop().toString());
    					result = val1 * val2;
    					stack.push(new Integer(result));
    				}
    				else if(token.equals("/"))
    				{
    					val1 = Integer.parseInt(stack.pop().toString());
    					val2 = Integer.parseInt(stack.pop().toString());
    					result = val2 / val1;
    					stack.push(new Integer(result));
    				}
    				
    			}
    		}
    	}
    	
    	public String getResult()
    	{
    		return String.valueOf(stack.top());
    	}
    }
    

  3. In Topic: Applet java GUI building to display words to user

    Posted 18 Nov 2014

    i need a lot of help please? i want to know hw to use calendar object class better for my project.
    My point is to display a text from my two dimensional array words when i hit yesterday button and when i click on tomorrow button it will show another fact as text from my other two dimensional array words.
  4. In Topic: Applet java GUI building to display words to user

    Posted 18 Nov 2014

    My action performed sMessage is wrong since am adding a text stored in my string where i want my GUI to use my three values initializeOctober(); initializeNovember(); and initializeDecember(); from my other class named database?
    how do i use calendar object to display my facts within my action performed? will i need an array list for all my words that will be in yesterday and tomorrow button?
    i've been working on it for days.

    GUI
    String sMessage = new String("");
        String sMessage2 = new String(""); //Declare two new buttons
        Button Button1;
        Button Button2;
        Label text;
    
    public void actionPerformed(ActionEvent ae){
            //store the name of the button pressed in sString
            String sString = ae.getActionCommand();
            if (sString.equals("Yesterday"))
            //for(int i = initializeOctober; i >= today-1; today--);
               // sMessage = "First computer 21 Jan 1944. The Mark Serries of computers is first invented at Harvard University. From here on the computer advance quickly.";
            else if (sString.equals("Tomorrow"))
              //  sMessage = "The World Wide Web 6 Aug 1991. The World wide Web was launched in August 6. Information can now be passed around the world in less than seconds.";
                repaint();
            if (sString.equals("Yesterday"))
            //for(int i = today; i >= today-1; today--);
              //  sMessage2 = "test 3, test 4";
            else if (sString.equals("Tomorrow"))
              //  sMessage2 = "value 1, value 2, value 4";//for(int i=today; i<= today+1; today++);
            repaint();
        }
        
        public void paint (Graphics g) 
        {
           // g.drawString(sMessage,5,100); //writes text away from buttons
           // g.drawString(sMessage2, 9, 200);
        }
    
    
  5. In Topic: Java Mad Lib program

    Posted 26 Oct 2014

    Am i using scanner and fileinput stream correctly to read three text?
    I wanted to change my % and # into different word.

My Information

Member Title:
D.I.C Head
Age:
25 years old
Birthday:
March 31, 1989
Gender:
Interests:
studying computer science bachelor degree
at private college.
Full Name:
Ricardo Arteaga
Years Programming:
2
Programming Languages:
Java
C++
HTML
XHTML
CSS
SQL

Contact Information

E-mail:
Private
Skype:
Skype  rickyrose9
Facebook:
facebook.com/Ricardo

Comments

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