CMSC 131 -- Object Oriented Programming I

Sections 020x/030x -- Spring 2013

Fear the Turtle!

Supplementals

 

These code examples are provided for your convenience. Many are taken directly from classroom lectures. In order to access them, you should click on the desired link, at which point the Java code should appear in your browser. Save that code to a file. Make sure that you Save As to a filename that is the same as the class name defined in the file. For example, if the public class defined within the file you've selected is HelloWorld, then your filename should be HelloWorld.java.

Next, you need to open Eclipse (if you have not already done so), and select the Project Explorer frame. I suggest creating an empty project that you will use to manage all of the class examples that you download from this site. Call that project something meaningful to you. Click left on that project and it should open. Click left on that project name, and then select the src package. This is necessary to insure that the file you're downloading is installed in the src package.

(Note: if you're downloading a code fragment that originated in a different package, especially student_classes or student_utilities, then you should first create that package from within Eclipse, and then make sure that you are importing the file in question into that package. Once you have created that package within the target project, you may down load any other classes that are defined within that package by just selecting it from the downdown before performing the Import step.)

From the File menu at the top of the frame, select Import, then select General and then File System. That dialogue should ask you at some point for the pathname to the file that you wish to import. If you are successful, the file should appear within Eclipse, within the desired package. Double clicking on that file, should open the associated source code in the editor. Enjoy!


Week Number Relevant Code Examples
1: 23 Jan - 25 Jan
2: 28 Jan - 2 Feb HelloWorld2.java   DoSomeMath.java   AddOne.java
3: 4 Feb - 8 Feb SimpleInput.java   SimpleConditional.java   NestedConditional.java   CompoundConditional.java   SimpleWhile.java   SimpleDoWhile.java   SimpleDoWhileWithMethod.java
4: 11 Feb - 15 Feb SimpleFor.java   SumToN.java   NestedForLoops.java   NestedForLoops2.java   NestedWhileLoops.java   ShortCircuit.java   SomeMoreStrings.java
5: 18 Feb - 22 Feb Point.java  NumericExamples.java
6: 25 Feb - 1 Mar. SingleDie.java Average Calculator
7: 25 Mar - 29 Mar. FancyWord.java and its tester TestingFancyWord.java For more experience with debugging, we'll also use ... StringHolder.java and its corresponding test module, TestingExample.java
8: 1 Apr - 5 Apr SimpleArrays.java
9: 8 Apr - 13 Apr String and Array ops code. (Self contained source and test code as well.) I suggest for additional review for Mid term two, look at (and try!) the Try and catch example. And, as promised, please have a look at Two for Review if you're interested in some of the topics discussed this week.
10: 15 Apr. - 19 Apr Animal, and a client class (or two) that uses it: a Cat and a comparable version, the incomparable cat, and a dog or or two; and the incomparable dog. Of course, we will need drivers to run them, which are found in version 1 and another one, for good measure. Last minte stuff! you'll need this for Wednesday's lab: which is an incomplete version of code that you will finish by next week.
11: 22 apr. - 26 Apr. Here's some some vectoring code, and its tester
12: 29 Apr. 3 May Go here to retrieve the Human class definition, relies upon the interface.

 

Web Accessibility