19 Pages

lect02

Course: ECE 242, Fall 2009
School: UMass (Amherst)
Rating:
 
 
 
 
 

Word Count: 543

Document Preview

242 ECE Spring 2003 Data Structures in Java http://rio.ecs.umass.edu/ece242 Lecture 2 Prof. Lixin Gao ECE242 Spring 2003 Data Structures in Java, Prof. Gao 1 Todays Topics Introduction to Java Java Installation Simple Examples: HelloWorld.java Data Types Input/Output ECE242 Spring 2003 Data Structures in Java, Prof. Gao 2 Why Java? Object-Oriented Programming Language Vs. C Like C++ Portable...

Register Now

Unformatted Document Excerpt

Coursehero >> Massachusetts >> UMass (Amherst) >> ECE 242

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
242 ECE Spring 2003 Data Structures in Java http://rio.ecs.umass.edu/ece242 Lecture 2 Prof. Lixin Gao ECE242 Spring 2003 Data Structures in Java, Prof. Gao 1 Todays Topics Introduction to Java Java Installation Simple Examples: HelloWorld.java Data Types Input/Output ECE242 Spring 2003 Data Structures in Java, Prof. Gao 2 Why Java? Object-Oriented Programming Language Vs. C Like C++ Portable ECE242 Spring 2003 Data Structures in Java, Prof. Gao 3 Object-Oriented Programming Object-oriented programming vs. Function Graphic user interface (GUI) Interactivity ECE242 Spring 2003 Data Structures in Java, Prof. Gao 4 Portability of Java Compiler Unix Compiler C source code MacOS Compiler Windows Compiler Binary code Unix MacOS Windows Java source code ECE242 Spring 2003 Java Compiler Byte Code Java Virtual Machine (Interpreter) 5 Data Structures in Java, Prof. Gao Applet Demo Bookflip http://rio.ecs.umass.edu/ece242/applet/ bookflip/bookflip.html Lake http://rio.ecs.umass.edu /ece242/applet/lake/anlake2.html ECE242 Spring 2003 Data Structures in Java, Prof. Gao 6 Installation Install JDK 1.3.1 from http://java.sun.com/j2se/1.3/ first Install TextPad from http://www.textpad.com/download/index.html These software are available in computer lab ECE242 Spring 2003 Data Structures in Java, Prof. Gao 7 Examples HelloWorld.java class HelloWorld { public static void main(String args[]) { System.out.println("Hello, World!"); } } ECE242 Spring 2003 Data Structures in Java, Prof. Gao 8 Compile/Run Command for Compile Java javac HelloWorld.java c:\jdk1.3.1_01\bin\javac HelloWorld.java Command for Run Java java HelloWorld c:\jdk1.3.1_01\bin\java HelloWorld ECE242 Spring 2003 Data Structures in Java, Prof. Gao 9 Data Types (1) Define a data type Integer ECE242 Spring 2003 int i=100; short j; long red, green, blue; float height; double weight; boolean isover; Data Structures in Java, Prof. Gao 10 Floating-Point Boolean Data Types (2) Char char c=y; String String message; String className=ece242; ECE242 2003 Data Spring Structures in Java, Prof. Gao 11 Expression Add/Subtract x = y + 3; m = n 4; Multiply/division x = y / 3; m=2*6; More complex z = (10+x)*5 +2*y; ECE242 Spring 2003 Data Structures in Java, Prof. Gao 12 Expression Type conversion (Be careful) Examples: int x = 150; float y, z; y = x/60; z = (float)x/60; Result for y and z is different y = 2; z = 2.5; ECE242 Spring 2003 Data Structures in Java, Prof. Gao 13 Operations from highest to lowest precedence 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. . ++ * + << < == & ^ && || ?: = [] -/ >> > != () ! % >>> <= ~ >= ECE242 Spring 2003 Data Structures in Java, Prof. Gao 14 Examples MinutesToHours.Java class MinutesToHours { public static void main(String args[]) { int minutes = 150; float hours; hours = (float)minutes/60; System.out.println( "Convert result: " + minutes + " minutes is " + hours + " hours "); } } ECE242 Spring 2003 Data Structures in Java, Prof. Gao 15 Input/Output InputOutput.java Input your name, print out your name Input your age, print out our age Input your height, print out your height Using EasyIn.java ECE242 Spring 2003 Data Structures in Java, Prof. Gao 16 InputOutput.java (1) class InputOutput { public static void main(String args[]) { EasyIn easy = new EasyIn(); String name; System.out.print("enter your name: "); name = easy.readString(); System.out.println("Your name is: " + ECE242 Spring 2003 Data Structures in Java, Prof. Gao 17 InputOutput.java (2) (continued) int age; System.out.print("enter your age: "); age = easy.readInt(); System.out.println("Your age is: " + age ); ECE242 Spring 2003 Data Structures in Java, Prof. Gao 18 InputOutput.java (3) (continued) float height; System.out.print("enter your height(feet): "); height = easy.readFloat(); System.out.println("Your height is: " + height + " feet" ); } } ECE242 Spring 2003 Data Structures in Java, Prof. Gao 19
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

UMass (Amherst) - ECE - 242
ECE 242 Spring 2003Data Structures in Javahttp:/rio.ecs.umass.edu/ece242Algorithm Analysis 1Prof. Lixin GaoECE242 Spring 2003 Data Structures in Java, Prof. Gao 1Todays Topics Introduction to analysis of algorithms. Big O notationECE242
UMass (Amherst) - ECE - 242
ECE 242 Spring 2003Data Structures in Javahttp:/rio.ecs.umass.edu/ece242Lecture 1Prof. Lixin GaoECE242 Spring 2003 Data Structures in Java, Prof. Gao 1Today's Topics Motivation Organization Prerequisite test NOT COUNTED TOWARD YOUR GRADE
UMass (Amherst) - ECE - 242
ECE 242 Spring 2003Data Structures in Javahttp:/rio.ecs.umass.edu/ece242Functions and ParametersProf. Lixin GaoECE242 Spring 2003 Data Structures in Java, Prof. Gao 1Todays Topics Function or Method ParametersECE242 Spring 2003Data Str
UMass (Amherst) - ECE - 242
ECE 242 Spring 2003Data Structures in Javahttp:/rio.ecs.umass.edu/ece242Hash TableProf. Lixin GaoECE242 Spring 2003Data Structures in Java, Prof. Gao1Todays Topics Hash Table Motivation Hash Function Collision ComplexityECE242 Sp
UMass (Amherst) - ECE - 242
ECE 242 Spring 2003Data Structures in Javahttp:/rio.ecs.umass.edu/ece242Algorithm Analysis 2Prof. Lixin GaoECE242 Spring 2003 Data Structures in Java, Prof. Gao 1Today's Topics Big O notation comparison Analyzing Algorithm Selection Sort
UMass (Amherst) - ECE - 242
ECE 242 Spring 2003Data Structures in Javahttp:/rio.ecs.umass.edu/ece242StackProf. Lixin GaoECE242 Spring 2003Data Structures in Java, Prof. Gao1Todays Topics Abstract Data Types Stack Implementation of Stack Usage of StackECE242
UMass (Amherst) - ECE - 242
ECE 242 Spring 2003Data Structures in Javahttp:/rio.ecs.umass.edu/ece242JAVA Conditional StatementsProf. Lixin GaoECE242 Spring 2003 Data Structures in Java, Prof. Gao 1Today's Topics if-else statements switch statements for loop while
UMass (Amherst) - ECE - 242
ECE 242 Spring 2003Data Structures in Javahttp:/rio.ecs.umass.edu/ece242QueueProf. Lixin GaoECE242 Spring 2003Data Structures in Java, Prof. Gao1Today's Topics Queue Implementation of Queue Usage of QueueECE242 Spring 2003Data St
UMass (Amherst) - ECE - 242
ECE 242 Spring 2003Data Structures in Javahttp:/rio.ecs.umass.edu/ece242Object Oriented Programming (5)Prof. Lixin GaoECE242 Spring 2003 Data Structures in Java, Prof. Gao 1Today's Topics Exercise for Object-Oriented Programming Constructo
UMass (Amherst) - ECE - 242
ECE 242 Spring 2003Data Structures in Javahttp:/rio.ecs.umass.edu/ece242Heap and HeapSortProf. Lixin GaoECE242 Spring 2003Data Structures in Java, Prof. Gao1Todays Topics Review CBT &amp; BST Heap HeapSortECE242 Spring 2003Data Str
UMass (Amherst) - ECE - 242
ECE 242 Spring 2003Data Structures in Javahttp:/rio.ecs.umass.edu/ece242Object-Oriented Programming (1)Prof. Lixin GaoECE242 Spring 2003 Data Structures in Java, Prof. Gao 1Today's Topics Object Oriented Design Class Instance variables
UMass (Amherst) - ECE - 242
ECE 242 Spring 2003Data Structures in Javahttp:/rio.ecs.umass.edu/ece242List Prof. Lixin GaoECE242 Spring 2003 Data Structures in Java, Prof. Gao 1Todays Topics A New Abstract Data Type: List Array Implementation of List Limitation of Arr
UMass (Amherst) - ECE - 242
ECE 242 Spring 2003Data Structures in Javahttp:/rio.ecs.umass.edu/ece242RecursionProf. Lixin GaoECE242 Spring 2003Data Structures in Java, Prof. Gao1Todays Topics Introduction to recursion How recursion works Some examplesECE242 Spr
UMass (Amherst) - ECE - 242
ECE 242 Spring 2003Data Structures in Javahttp:/rio.ecs.umass.edu/ece242General Tree &amp; Complete Binary TreeProf. Lixin GaoECE242 Spring 2003Data Structures in Java, Prof. Gao1Today's Topics General Tree Binary Tree Complete Binary Tr
UMass (Amherst) - ECE - 242
Solution For Sample Final Exam1. Please refer to the class notes and textbook for the concepts. 2. a. The adjacency matrix representation: A[i][j] 0 1 2 3 4 0 0 1 0 1 0 1 1 0 1 0 1 2 0 1 0 0 1 3 1 0 0 0 1 4 0 1 1 1 0b. The adjacency list represent
UMass (Amherst) - ECE - 242
Project 1 ECE242 Data Structures in Java Spring 2003 Due date: 11:00pm on February 18, 2003 (Off-campus, 10 days after receiving the videotape of this lecture) Description: This project gives you a chance to get familiar with some basic Java programm
UMass (Amherst) - ECE - 242
ECE 242 Spring 2003Data Structures in Javahttp:/rio.ecs.umass.edu/ece242Object-Oriented Programming (1)Prof. Lixin GaoECE242 Spring 2003 Data Structures in Java, Prof. Gao 1Today's Topics Object Oriented Design Class Instance variables
UMass (Amherst) - ECE - 242
ECE 242 Data Structures in Java Instructor: Prof L. Gao Project 4 Queue implementation using Linked ListDue date: 11:00pm on Apr 10, 2003 (Off-campus, 10 days after receiving the videotape of this lecture) In this project you will use Linked List
UMass (Amherst) - ECE - 242
Project 1 ECE242 Data Structures in Java Spring 2003 Due date: 11:00pm on February 18, 2003 (Off-campus, 10 days after receiving the videotape of this lecture) Description: This project gives you a chance to get familiar with some basic Java programm
UMass (Amherst) - ECE - 242
ECE242: Spring 2003 Prerequisites Test Solution(Not counted toward your grade) Instructor: Prof. Lixin GaoName: Student ID:Questions: 1. (a) What year are you in? What is your major?(b) Have you taken ECE122 or any other equivalent courses? If
UMass (Amherst) - ECE - 242
ECE242 Data Structures in Java Project 5: Linked List &amp; Recursion Spring 2003 Due date: 11:00pm, Apr 26, 2003 (Off-campus, 10 days after receiving the videotape of this lecture) Description: Write a Java address book program to keep the contact infor
UMass (Amherst) - ECE - 242
Project 2 ECE242 Data Structures in Java Spring 2003 Due date: 11:00pm, March 1, 2003 (Off-campus, 10 days after receiving the videotape of this lecture) Description: (Please upload your work to PROG2 directory on ftp server, rio.ecs.umass.edu) This
UMass (Amherst) - ECE - 242
ECE 242 Data Structures in Java Instructor: Prof L. Gao Project 3 Object Oriented ProgrammingDue date: 11:00pm on March 25, 2003 (Off-campus, 10 days after receiving the videotape of this lecture) In this project you will use Object Oriented Progr
UMass (Amherst) - ECE - 242
ECE 242 Data Structures in Java Instructor: Prof L. Gao Project 4 Queue implementation using Linked ListDue date: 11:00pm on Apr 10, 2003 (Off-campus, 10 days after receiving the videotape of this lecture) In this project you will use Linked List
UMass (Amherst) - ECE - 242
Most of the students did very well on project 3. It seems thatabout 90% of the students got the concept of Object OrientedProgramming.Most of the students got the concept of passing Objects asarguments in methods and were able to manipulate the
UMass (Amherst) - ECE - 242
general comments:1. Some students did not submit all java files, especially EasyIn.java file. So we can not compile/run their program without copying EasyIn.java from our course website.2. The input format in some students' codes did not sa
UMass (Amherst) - ECE - 242
GRADING CRITERIA FOR PROJECT 3 - Object oriented programming style and code documentation (20 points) * Students must show understanding of object oriented programming concepts. Code must be split into multiple classes. -
UMass (Amherst) - ECE - 242
Schedule for ECE242 Fall 2003, NTU students+First Day 09/03/2003Project 01: 09/19/2003Project 02: 10/02/20031st Midterm: 10/17/2003 last lecture to be viewed: lecture 17 (session 17 in CD)Project 03: 10/30/2003Project 04: 11/10/20
UMass (Amherst) - ECE - 242
GRADING CRITERIA FOR PROJECT 4 Compiles Properly - 20 points Linked List Implementation - 20 points Queue using Linked list - 20 points Proper use of queue in MyCapital - 20 points Proper Output - 20 points
UMass (Amherst) - ECE - 242
The Grading Criteria for Project 1 was as follows:1. Missing any neccessary java files -10 points2. Incorrect input format (inconsistent with requirements) -10 points3. Program does not allow the customer to check
UMass (Amherst) - ECE - 242
Grading Criteria: 50 points for each section -10 points if the code does not compile -5 points for minor errors for extra credit : 10 points for random generation of records and 10 points if you calculated the runni
UMass (Amherst) - ECE - 242
General Comments:Almost everyone has got this project right. This shows that they have got the concept of using recursion fairly well.
UMass (Amherst) - ECE - 122
From tessier@ecs.umass.edu Sat Sep 2 17:39:47 2006From: tessier@ecs.umass.edu (Russell Tessier)Date: Sat, 2 Sep 2006 12:39:47 -0400 (EDT)Subject: [Ece122_list] Undergraduate TA opportunityIn-Reply-To: &lt;200608241303.k7OD30Z12225@davis.ecs.umass.
UMass (Amherst) - ECE - 697
Lecture Oct 16Q1:How about this case: (slide 15), for case2, Path(A.B.C.D.E,R) and path (C,D, E,R) and then receive update path (B,C, F,R)A:Then, (B,C, F,R) is infeasible. - choose the one 'most' direct.Q2:Why distinguish policy withdrawal a
UMass (Amherst) - ECE - 697
Lecture notes for &quot;Network topology-Inferences&quot;Part IQuestion: Why IPSs put their resource message on the Internet?Answer: Many people could benefit from them. And it's a good method to debug their own network also.Q: Does &quot;Loo
UMass (Amherst) - ECE - 697
Q1) Whether Dispute wheel approach is used in actual BGP protocol to judge stability.A1) No, as they are very resource inetnsive. It's more of a theoretical approach.Q2) What is the difference between NP complete and NP-hard?A2) NP complete are t
UMass (Amherst) - ECE - 697
-ECE 697 F-Advanced Computer Networks-Class notes for IP addressing and Routing Protocols--Hot topic for discussion and research: -1. Do the network prefixes have to be continuous bits in the IP address?2.Why do we do multihoming?A
UMass (Amherst) - ECE - 697
1.Q: Why not generating network topologies from top tiers to lower tiers?A: If so, the generator will span a much larger area geography as well as relationships which cause too much labor.2.Q: Is Waxman model reasonable for locality?A: It
UMass (Amherst) - ECE - 697
HLP: A Next Generation Inter-domain Routing ProtocolLakshminarayanan Subramanian Matthew Caesar Morley Mao Scott Shenker Cheng Tien Ee Ion Stoica Mark HandleyAbstractIt is well-known that BGP, the current inter-domain routing protocol, has many d
UMass (Amherst) - ECE - 665
Randomized Algorithms1Upper BoundsWe'd like to say &quot;Algorithm A never takes more than f(n) steps for an input of size n&quot; &quot;BigO&quot; Notation gives worstcase, i.e., maximum, running times. A correct algorithm is a constructive upper bound on the c
UMass (Amherst) - ECE - 697
Routing BehaviorProf. Gao Persistent OscillationECE697A Fall 2003 Advanced Computer Networks OutlineSo far, Persistent Oscillation due to EBGPPersistent Oscillation due to IBGP Routing oscillation in IBGP with route reflect
UMass (Amherst) - ECE - 697
NetworkTopology InferencesProf.Gao ECE697AFall2003 AdvancedComputerNetworks OutlineTopologyInferencesASlevelconnectivity FromRoutingTables FromRoutingdynamics Combinedwithotherresources Rocketfuel LinkweightinferencesRouterLevelconn
UMass (Amherst) - ECE - 697
Routing Behavior Routing InstabilityProf. Gao ECE697A Fall 2003 Advanced Computer Networks OutlineEndtoEnd measurementRouting dynamicsLargescale routing behavior in the Internet Delayed Internet routing convergence Motivatio
UMass (Amherst) - ECE - 665
ShortestPaths8 B 2 8 2 7 5 E 3 C A 0 4 1 8 F D 5 3 2 9ShortestPaths1OutlineandReadingWeightedgraphs(7.1) Shortestpathproblem Shortestpathproperties Algorithm EdgerelaxationDijkstrasalgorithm(7.1.1) TheBellmanFordalgorithm(7.1.2) Short
UMass (Amherst) - ECE - 697
RoutingProtocolsRIP,ISIS,OSPF,andBGPProf.Gao ECE697AFall2003 AdvancedComputerNetworks Outline RoutingAlgorithms InternetStructure Router,Hosts AutonomousSystem(AS) RIP,ISIS,OSPF BGPIntraDomainRoutingInterDomainRoutingRouteCo
UMass (Amherst) - ECE - 697
Network Topology PropertiesProf. Gao ECE697A Fall 2003 Advanced Computer Networks OutlineHow does network topology look like?Properties of Network TopologyRandom Graph?Degree distributionStructure Power lawHierarchical
UMass (Amherst) - ECE - 697
Research Progress on Interdomain RoutingProf. Gao ECE697J Spring 2005 Advanced Computer Networks Where are we in interdomain routing?Research since 1997, more intensive last five years Both theoretical research as well as extensive m
UMass (Amherst) - ECE - 697
Introduction Prof. Gao ECE697J Spring 2005 Advanced Computer NeworksToday's Outline Course description Course format A survey from youCourse GoalsIntroduction to research topics in computer networks Research skills: Survey existing
UMass (Amherst) - ECE - 697
RoutingConvergenceDelayProf.Gao ECE697JSpring2005 AdvancedComputerNetworks ProjectProposalContent: Motivationofproject Proposedapproach:analytical,experimental, measurement,simulation,survey Teamofatmost2students Pleasefeelfreetotalkw
UMass (Amherst) - ECE - 697
BGP/Router Behavior under StressProf. Gao ECE697A Fall 2003 Advanced Computer Networks Outline BGP behavior under stress Router response on large BGP routing table load What could cause BGP instability? How BGP behaves unde
UMass (Amherst) - ECE - 697
RoutingBehaviorPersistentOscillationProf.Gao ECE697AFall2003 AdvancedComputerNetworksOutlinePersistentOscillationduetoEBGP Mightneverconverge AnalysisofBGPconvergenceproperties StableInternetroutingwithoutglobalcoordination Routingosc
UMass (Amherst) - ECE - 697
NetworkTopology FaultToleranceProf.Gao ECE697AFall2003 AdvancedComputerNetworks OutlineFaulttoleranceofInternettopology Randomfailures Selectivefailures(attacks)RouterlevelTopologySCANandLucentInternetMapping Project Routerlevelt
UMass (Amherst) - ASTR - 114
B 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35RVWYAstronomy 114 - Spring 2008 - Prof. Julio NavarroStudent Code Homework Quiz Final Exam Letter Grade grade grade grade Final63 158 415 436
UMass (Amherst) - ECO - 5
On Subjacency and A movement in Hindi/Urdu One of the long-term debates in the modular approach concerns the level at which Subjacency applies. The locus of the issue is the fact that languages like English, which involve overt displacement of the Wh
UMass (Amherst) - LING - 201
UMass (Amherst) - LING - 201
Linguistics 201 Section B Morphology Handout 1 If you were asked what the smallest meaningful element in your language was, your first answer might have been words, obviously. This answer seems obvious to us because we ordinarily think of utterances
UMass (Amherst) - LING - 201
Linguistics 201/Section E February 14, 2008 Morphology Handout 3 1. Morphological trees So far we have indicated morpheme boundaries simply by putting a hyphen between the morphemes: cat-s, mean-ing-ful etc. However, this notation is not accurate eno
UMass (Amherst) - LING - 201
Ling 201/ Section E Lecture NotesIntroduction1. Defining properties of human languages Human language is a discrete combinatorial system: Speakers have at their disposal an inventory of building blocks which they can combine to form bigger units (
UMass (Amherst) - LING - 201
Homework Assignment 4 Name: _Page 1Linguistics 201, Sect B.~ I. FranaHomework Assignment 4 Due date: 1. Voiced or voiceless? Thursday March 13 at the beginning of classAre the first and last sounds in each of the following words voiced or voi
UMass (Amherst) - LING - 201
Homework Assignment 5 Name: _Page 1Linguistics 201, Sect E~ I. FranaHomework Assignment 5 Due date: Tuesday March 25 at the beginning of classFor this homework, you need to use the IPA charts on the last page. Good luck and happy spring break
UMass (Amherst) - LING - 201
Homework Assignment 6 Name: _Page 1Linguistics 201, Sect E.~ I. FranaHomework Assignment 6 Due date: 1. Spanish Tuesday April 1st at the beginning of classExamine the sound segments [d] and [] in the following data from Spanish. 1. [drama] 2.