CIS112 Programming Examples
Your system will have to have a program set to load .java extension files. Except for review, examples will generally follow book, but will have enhancements.
|
Basic Input Class - Will Not be Reviewed in Class
|
|
| 0 | Savitchin.java input/output class will not be reviewing in class but needed for programs |
|
Chapter 1-7 Review Programs
|
|
| 1 | EggBasket.java page 54 |
| 2 | EggBasket1.java structure - object oriented version of EggBasket |
| 3 | ItemsForSale.java base class demonstrates arrays, protected, final |
| 4 | CostOfItemsForSale.java last review program, demonstrates inheritance, super and override |
|
Chapter 8 Examples - Exceptions
|
|
| 5 | HelloWorld3.java throws an exception but doesn't handle it |
| 6 | GotMilk.java copy of example on page 515 |
| 7 | GotMilk1.java structured version of above book example |
| 8 | GotMilk2.java exception example of GotMilk1.java structured version of book example on page 516 |
| 9 | GotMilk3.java additional exception example |
| 10 | DivideByZero.java example of creating a new exception pages 529-531 |
| 11 | DivideByZero1.java example adding two exceptions |
| 10 |
DivideByZero2.java demonstrates multiple exceptions, multiple catches, and throws |
| 11 | DivideByZero3.java demonstrates simplfied exception creation and string tokenizer |
|
Chapter 9 File I/O |
|
| 13 | TextFileOutputDemo.java copy of example on page 583, demonstrates PrintWrite, File Creation |
| 14 | TextFileOutputDemo1.java writes 100 sequential numbers 5 per line, demonstrates flush, file append |
| 15 | TextFileInputDemo.java page 591 sample reads from text file using BufferedReader |
| 16 | WordFinder.java page 597 stringTokenizer example |
| 17 | WordCount.java start of a word count program, stringTokenizer and Input file I/O |
| 18 | TextEOFDemo.java page 600 demonstrates both file read and writing with EOF check |
|
Skipping Binary File I/O
|
|
| 19 | FileClassDemo2.java page 650 |
| 20 | FileClassDemo3.java upgraded version of FileClassDemo2.java further demonstrates File class methods |
|
Chapter 10 Dynamic Data Structures
|
|
| 22 | MyVector.java illustrates basic methods of java.util.Vector class |
| 23 | MyVector1.java illustrates need to typecast Object parent class |
| 24 | VectorDemo.java example from page 675 |
| 25 | VectorDemo1.java clone example class |
| End of First Handout | |
| 26 | ListNode.java book page 682 with main for testing |
| 27 | StringLinkedList.java page 683-684 |
| 28 | LinkedListDemo.java page 688 Display 10.8 |
|
29 |
StringLinkedListSelfContained.java Display 10.9 |
| 30 | StringLinkedListWithIterator.java Display 10.11 |
| 31 | StringLinkedListDemo2.java Implements 10.13 |
|
Chapter 11 Recursion
|
|
| 32 | MyFactorialrec.java examples of recursion and corresponding iterative methods |
| 33 | RecursionDemo.java Display 11.1 - translates integer to corresponding english digits |
| 34 | IterativeDemo.java Display 11.3 iterative version of recursiondemo.java |
| 35 | RecursionDemo2.java Display 11.4 counts number of 0 in an integer |
| 36 | CountDown.java Display 11.5 with enhancements, counts down |
|
37 |
ArraySearcher.java Display 11.6 Recursive code for Binary Search |
| 38 | ArraySearcherDemo.java Display 11.8 main method for calling the Binary Search |
|
Chapter 12 Swing |
|
| 39 | FirstSwingDemo.java Display 12.1 creates JFrame object |
| 40 | WindowDestroyer.java Display 12.2 implements the event closeWindow |
| 41 | FirstWindow.java Display 12.4 illustrates JFrame inheritance to create a basic JFrame window |
| 42 | FirstWindowDemo.java Display 12.5 has main program for creating FirstWindow Object |
| 43 | SecondWindow.java display 12.6 extends JFrame and adds constructor for setting content Pane background color |
| 44 | SecondWindowDemo.java Display 12.8 creates two SecondWindow objects with differenct background colors |
| 45 | BorderLayoutDemo.java Display 12.10 extends JFrame and illustrate layout manager class BorderLayout |
|
46 |
ButtonDemo.java Display 12.12 extends JFrame implement ActionListener, illustrates two buttons |
| 47 | PanelDemo.java Display 12.13 illustrates putting the two previous buttons inside a panel at South of Content Pane |
| 48 | MemoSaver.java Display 12.15 illustrates JTextArea with two strings of text that can be displayed one at a time |
| 49 | LabelDemo.java Display 12.16 illustrates JTextField one line TextArea |
| 50 | |