| ||||||||||
Question Could you please explain in clear and concise terms what StringNode.java is supposed to do. |
Question: I don't really see the whole picture. Can anyone please tell me what are we creating with this hw? Thank you |
Question: For StringList.java the first two methods:public StringList(){…} public StringList(StringNode head){…}have no return type. Are these supposed to be constructors? |
Question:I don't understand exactly what our linked list is supposed to do. Is each node supposed to be a separate file? Since we are only turning in 2 files (one for the head, and one as the first node) does this linked like HW3 only have 2 nodes? |
Question: Is there any way to check whether my codes are right or wrong (working properly)? For example, in CS1371 we were provided with an instance (lines of code to be executed in the interactions pane)and returns we should get if these codes were executed with the java class I have written. |
Question: I cannot figure out how to open the javadoc that was posted. It keeps opening in Word, and is encrypted. Can someone please tell me how to open this? |
Question: For the sortList() in the extra credit, how are the nodes supposed to be sorted? |
Question: So I guess Main method is not required for this hw? |
Question: What does the error message "unreachable statement mean" that I get when try to delete the first node. I got the unreachable statement for this: if (current.getNext() != null) |
public String capitalize(String s){ if(Character.isLowerCase(s.charAt(0)){ if (s.length > 1) s = Character.toUpperCase(s.charAt(0)) + s.substring(1, s.length()); else s = Character.toUpperCase(s.charAt(0)); } return s; System.out.println("New String: " + s); }The last line (System.out.println("New String: " + s);) is an unreachable statement, because the method already "returns" before that line and will always return before that line. This example however does not have the same problem:
public String capitalize(String s){ if(Character.isLowerCase(s.charAt(0)){ if (s.length > 1) return Character.toUpperCase(s.charAt(0)) + s.substring(1, s.length()); else return Character.toUpperCase(s.charAt(0)); } return s; }There are return statements before the last return s;, but note that the previous return statements are constrained by conditionals (if and else). The returns in this example all signal the end of the method, whereas in the previous example, the return is misplaced and occurs before the entire method completes. Dawn Finney
Question: My code keeps running and running and running...What can I do about it? |
Question: How do I actually create the linked list. When i try to test my methods, in the interactions pane i get some return that indicates that the list is empty. For instance, if i test: listTester.addToTail(two); it returns just: two So where's my list to begin with? Also, in the main method i have the following lines: StringNode one = new StringNode("one"); StringNode two = new StringNode("two"); StringNode three = new StringNode("three"); StringNode four = new StringNode("four"); |
Question: What is "toString()" supposed to do in StringNode.java? Does it just return what the string data is in the current node? |
Question: I understand how providing an example(instance) is bad, but could you please give at least a simple example of what the homework is doing? |
public static void main(String[]args){ //declare the nodes StringNode dawnNode = new StringNode("Dawn"); StringNode katieNode = new StringNode("Katie"); StringNode smithNode = new StringNode("Professor REMOVED"); StringNode ricardoNode = new StringNode("Ricardo"); //link the nodes smithNode.setNext(katieNode); katieNode.setNext(ricardoNode); //create a list StringList cs1316List = new StringList(smithNode); //print the list before System.out.println(cs1316List); //test the method cs1316List.addToFront(dawnNode); //print the list after System.out.println(cs1316List); }Dawn Finney.
Question: I'm having a hard time understanding what the homework is supposed to do.. |
Question: When i have the following lines in the testing mainStringNode one = new StringNode("one"); StringNode two = new StringNode("two"); StringNode three = new StringNode("three"); StringNode four = new StringNode("four");How do i link these nodes together to actually create the linked list? |
Question: What does this error mean?1 error found: File: C:\Users\Works\2008\Georgia Tech\2008 Summer\Rep Behavior CS 1316\HW03\StringNode.java [line: 56] Error: C:\Users\Works\2008\Georgia Tech\2008 Summer\Rep Behavior CS 1316\HW03\StringNode.java:56: non-static method toString() cannot be referenced from a static context |
StringNode dNode = new StringNode("D"); System.out.println(dNode.toString()); // same as System.out.println(dNode);Dawn Finney
Question: I did everything you said to do in the main method, yet it only prints out the one letter several times that I set to the front with the addToFront method. Why aren't the rest printed out? Also, the size of my list is 4, but I only get # 3 back after calling on that method. |
Question: Well.. should System.out.println(cs1316list); not work because it's only a data structure? I mean, it's only a node, not a string... |