Notes From Class
Week 1: January 28, 30, and February 1, 2008
Week 3: February 11, 13 and 15, 2008
Site IP addresses
--------------------------------------------------
wam.umd.edu 128.8.10.141
128.8.10.142
128.8.10.143
glue.umd.edu 128.8.10.68
128.8.10.71
--------------------------------------------------
Week 4: February 18, 20 and 22, 2008
Unix Commands
--------------------------------------------------------------------------------
1. cd <-- change to home directory
2. cd file1 <-- change to directory file1
3. ls and ls -ls and ls -tl <-- list contents of a directory
4. mkdir file1 <-- make a directory called file1
5. rmdir file1 <-- remove directory file1
6. cp file1 file2 <-- copy file1 to file2
7. mv file1 file2 <-- move file1 to file2
--------------------------------------------------------------------------------
Note. Directories cannot be removed unless they are empty.
Let's suppose that you have created a file and now you want to remove it. Try:
8. rm file1 <-- remoove/delete file1
Text editor commands
--------------------------------------------------------------------------------
1. vi filename <-- use vi editor to change contents of filename.
For example, the command sequence:
prompt >> cd ../pub
prompt >> vi Welcome.html
prompt >> vi resume.html
prompt >> vi ce-systems.html
moves your shell to the public directory and then systemantically creates the
HTML files for your home page, resume and trip page. Notice that each file
name has the "html" extension -- web browsers need this information.
The class reader contains a list of basic editor commands.
--------------------------------------------------------------------------------
Week 5: February 25, 27 and 29, 2008
Week 6: March 3, 5 and 7, 2008
Week 7: March 10, 12 and 14, 2008
Week 8: March 17-21, 2008
Week 9: March 24, 26, and 28, 2008
Week 10: March 31. April 2 and 4, 2008
Week 12: April 14, 16 and 18, 2008
public class OpenChannel {
public static void main ( String args[] ) {
// Define two-dimensional array of channel properties....
double channel[][] = { { ... fill in missing details ... },
{ ... fill in missing details ... },
{ ... fill in missing details ... } };
// Print channel properties....
... fill in missing details ...
// Compute and print water velocities....
... fill in missing details ...
}
}
You should use a simple looping construc to print the channel properties and a second loop and Math methods to compute and pring the water velocities.
Week 13: April 21, 23 and 25, 2008
Week 14: April 28 and 30. May 2, 2008
Week 15: May 5, 7 and 9, 2008
A
collection
is an object that groups multiple elements into a single unit.
Units include:
Collections are used to store, retrieve, manipulate, and communicate aggregate data. Typically, they represent data items that form a natural group.
/**
* ==============================================================
* ArrayTest3.java: Demo ArrayList Example in Handout...
*
* Written by: Mark Austin April 2006
* ==============================================================
*/
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class ArrayTest3 {
public static void main( String args[] ) {
// Create and print a simple array of strings .....
List stringList = new ArrayList();
stringList.add("A");
stringList.add("Red");
stringList.add("Indian");
stringList.add("Thought");
stringList.add("He");
stringList.add("Might");
stringList.add("Eat");
stringList.add("Toffee");
stringList.add("In");
stringList.add("Church");
System.out.println("Use for loop to walk along list" );
System.out.println("=================================" );
for ( int i = 0; i < stringList.size(); i = i + 1 )
System.out.println("Name = " + stringList.get(i) );
System.out.println("Use Iterator to walk along list" );
System.out.println("=================================" );
Iterator iterator1 = stringList.iterator();
while ( iterator1.hasNext() != false ) {
String s = (String) iterator1.next();
System.out.println("Name = " + s );
}
}
}
Week 17: .....
Developed in January 2008 by Mark Austin
Copyright © 2008, Department of Civil and Environmental Engineering,
University of Maryland