KaptainCavy's Profile User Rating: -----

Reputation: 0 Apprentice
New Members
Active Posts:
13 (0.02 per day)
25-June 12
Profile Views:
Last Active:
User is offline Sep 18 2012 09:51 AM

Previous Fields

OS Preference:
Favorite Browser:
Favorite Processor:
Favorite Gaming Platform:
Your Car:
Dream Kudos:
Icon   KaptainCavy has not set their status

Posts I've Made

  1. In Topic: Stack as an array

    Posted 10 Sep 2012

    I am getting the following errors after making the changes sepp2k recommended:

    P2Cavallaro.java:43: error: a generic class may not extend java.lang.Throwable
    public class StackException extends RuntimeException {
    P2Cavallaro.java:54: error: non-static variable this cannot be referenced from a static context
    Stack<Character> openDelimiterStack = new Stack<Character>();
    P2Cavallaro.java:56: error: non-static variable expression cannot be referenced from a static context
    int characterCount = expression.length();
    P2Cavallaro.java:63: error: non-static variable expression cannot be referenced from a static context
    nextCharacter = expression.charAt(index);
    P2Cavallaro.java:74: error: incompatible types
    char openDelimiter = openDelimiterStack.pop();
    required: char
    found: void

    P2Cavallaro.java:84: error: cannot return a value from method whose result type is void
    return isBalanced;

    // program 
    public final class P2Cavallaro
    	// stack and stack methods 	
    	final String expression = "({[]})";
    	public class Stack<T>{
          private int top;
          private int[] storage;
          Stack(int capacity) {
                if (capacity <= 0)
                      throw new IllegalArgumentException(
                                 "Stack's capacity must be positive");
                storage = new int[capacity];
                top = -1;
          void push(int value) {
                if (top == storage.length)
                      throw new StackException("Stack's underlying storage is overflow");
                storage[top] = value;
          int peek() {
                if (top == -1)
                      throw new StackException("Stack is empty");
                return storage[top];
          void pop() {
                if (top == -1)
                      throw new StackException("Stack is empty");
          boolean isEmpty() {
                return (top == -1);
          public class StackException extends RuntimeException {
                public StackException(String message) {
    	// main
    	public static void main(String[] args)
    	   Stack<Character> openDelimiterStack = new Stack<Character>();
          int characterCount = expression.length();
          boolean isBalanced = true;
          int index = 0;
          char nextCharacter = ' ';
          for (; isBalanced && (index < characterCount); index++)
             nextCharacter = expression.charAt(index);
             switch (nextCharacter)
                case '(': case '[': case '{':
                case ')': case ']': case '}':
                   if (openDelimiterStack.isEmpty())
                      isBalanced = false;
                      char openDelimiter = openDelimiterStack.pop();
                      isBalanced = isPaired(openDelimiter, nextCharacter);
                default: break;
          if (!openDelimiterStack.isEmpty())
             isBalanced = false;
          return isBalanced;
       // Returns true if the given characters, open and close, form a pair
       // of parentheses, brackets, or braces.
       private static boolean isPaired(char open, char close)
          return (open == '(' && close == ')') ||
                 (open == '[' && close == ']') ||
                 (open == '{' && close == '}');
  2. In Topic: Computer Organization or Set Theory?

    Posted 2 Aug 2012

    View PostDarenR, on 02 August 2012 - 09:37 AM, said:

    Yeah I never heard of any of those classes or what they do. I went for BS in Software Engineering. So to sum up what your saying is that you are unsure as to how much work you can handle while taking college courses. Well talk to others who have taken the courses and ask them how much work is really involved and thus you will have your answer. Just remeber over taxing yourself never does anyoen any good.

    Exactly! Which is why I am in a bind right now.

    Set Theory -
    Propositional and predicate logic; mathematical induction. Logic and structure of sets as related to mathematical proof. Relations, and cardinality.

    Computer Organization -
    An overview of computer organization and design including Boolean algebra, combinational and sequential circuits, data
    representation, register transfer and microoperations, CPU organization, microprogrammed control, and machine language programming.

    Discrete Structures -
    Propositional and predicate logic, mathematical induction, and recursion. Sets, relations, functions. Graphs and trees. Boolean algebra and computer logic. Finite state machines and computability.

    Data Structures -
    Trees, graphs, and other forms of data structures and their implementations. Emphasizing abstract data types; static memory allocation vs. dynamic storage allocation; searching, hashing, and sorting methods; algorithm analysis.

My Information

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

Contact Information



KaptainCavy hasn't added any friends yet.


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