Difference between revisions of "CSC212 Lab 6 Solutions 2014"

From dftwiki3
Jump to: navigation, search
Line 5: Line 5:
 
=Problem 2=
 
=Problem 2=
 
<br />
 
<br />
Please change '''Lab6_2''' for '''MyLinkedList''' and you have the solution to [[CSC212 Lab 6 2014|Lab #6]], Problem 2.
+
<source lang="java">
<source lang="java">
 
  
 
class IntSLLNode {
 
class IntSLLNode {
Line 16: Line 15:
  
  
public class Lab6_2 {
+
public class MyLinkedList {
 
IntSLLNode head, tail;
 
IntSLLNode head, tail;
 
int length;
 
int length;
 
 
public Lab6_2() {
+
public MyLinkedList() {
 
head = tail = null;
 
head = tail = null;
 
length = 0;
 
length = 0;
Line 73: Line 72:
 
 
 
public static void main(String[] args) {
 
public static void main(String[] args) {
Lab6_2 L = new Lab6_2();
+
MyLinkedList L = new MyLinkedList();
 
 
 
L.printStatus( "Brand new list" );
 
L.printStatus( "Brand new list" );
Line 82: Line 81:
 
L.printStatus( "After adding 10, 20, ...  to tail...");
 
L.printStatus( "After adding 10, 20, ...  to tail...");
 
 
L = new Lab6_2();
+
L = new MyLinkedList();
 
L.printStatus( "Brand new list" );
 
L.printStatus( "Brand new list" );
 
 

Revision as of 12:06, 1 October 2014

--D. Thiebaut (talk) 13:04, 1 October 2014 (EDT)




...