130 likes | 265 Views
Java for the Electronic Textbook/Classroom on Ocean Wave Theory. May 25/2000 Sangsoo Ryu.
E N D
Java for the Electronic Textbook/Classroom on Ocean Wave Theory May 25/2000 Sangsoo Ryu Ocean Engineering / Texas A&M University
Nonlinear ocean waves: random wave characteristics, wave statistics, significant wave height and period, decomposition into plane progressive waves, wave spectra in 2-D and 3-D.Nonlinear wave theories: Stokes, cnoidal, stream func., solitary wave theoryOff-shore structure/wave interaction: TLPs and semi-submersiblesNon-linear wave effects: “ringing” or “springing,” wave impact and entryWave-wave interactions in ocean wavesNumerical methods TAMU’s Tasks Ocean Engineering / Texas A&M University
Project Overview • Building an interactive web site: CGI scripts, Java scripts/applets, ActiveX, VRML • Running Java Applets a.JDK @ www.javasoft.com b.web browser that supports Java (Netscape 3.01/4.0, IE3.0) • Examples of Java Applets Dr. Kinnas’ website: www.ce.utexas.edu/prof/kinnas/319lab/ Dr. Dalrymple’s website: www.coastal.udel.edu/faculty/rad/ Ocean Engineering / Texas A&M University
What's JAVA? Sun Microsystems James Gosling, Arthur Van Hoff, Andy Bechtolsheim Indonesian Coffee Ocean Engineering / Texas A&M University
Why JAVA is cool? A programming language ( better than Fortran, C++?) You can do: interact with web pages play games, realtime video, and inline sound/animation calculate spreadsheets chat in realtime get continuously updated data … As a language Java is: Simple Object-Oriented Platform Independent Safe High Performance Multi-Threaded Ocean Engineering / Texas A&M University
Basic Java Environment - web browser - Java compiler - Java interpreter - editor - debugger - visual development environment (Visual Café,…) ref. Java class – methods and data Ocean Engineering / Texas A&M University
JDK (v1.2) javac - compiler java - interpreter javaprof - profiler javah - header file generator jdb - java debugger appletviewer Ocean Engineering / Texas A&M University
Basic Syntax • Braces and Blocks – { and }, indentation • Comments - /* … */, or // • Data and Variables • Command Line Arguments (args[0], args[1],…) • If and Else Math Math.PI, Math.pow, Math.sqrt, Math.abs, Hyper.tanh, Math.asin, eig.Eigenmatrix, etc. System System.out.println, System.out.print, etc. Ocean Engineering / Texas A&M University
Procedure to Execute Java Program 1. Make Java source code (filename.java) 2. Execute Java compiler (c:\>javac filename.java) 3. Correct errors if they are found (see the comment below) 4. Get Java bytecode (filename.class) 5. Run Java interpreter (c:\>java filename) 6. Run appletviewer (c:\>appletviewer xxx.html) Types of Error 1. Compile-time error (syntax error) 2. Run-time error (ex. NaN) 3. Logical error Ocean Engineering / Texas A&M University
Example of Java Source Code Example of Html Tag // Description: This applet helps students determine the power needed for a pump import java.awt.*; public class Energy extends Applet implements Runnable rotatedarray[i]=(float)((thearray[i]-midx)*Math.cos(theangle)+(thearray[i+1]- midy)*Math.sin(theangle)+midx); rotatedarray[i+1]=(float)(-(thearray[i]-midx)*Math.sin(theangle)+(thearray[i+1]- midy)*Math.cos(theangle)+midy); public boolean mouseDrag(Event e,int x,int y) Example of HTML Tag <applet archive="Energy.zip" code="Energy.class" width=575 height=400> <IMG SRC="EnergyNoJava.gif" WIDTH="575" HEIGHT="400" ALT="Energy Applet Image (get Java!)"><BR>If you are reading this then your browser is not Java enabled, sorry. </applet> Ocean Engineering / Texas A&M University
Study Plan for JAVA Ocean Engineering / Texas A&M University
Examples Ocean Engineering / Texas A&M University
Coming Soon... 1. Visual toolkit install 2. Java graphics 3. Application to ALP example 4. Homepage development 5. Link with other softwares 6. …. Ocean Engineering / Texas A&M University