# Register now to access 7 million high quality study materials (What's Course Hero?) Course Hero is the premier provider of high quality online educational resources. With millions of study documents, online tutors, digital flashcards and free courseware, Course Hero is helping students learn more efficiently and effectively. Whether you're interested in exploring new subjects or mastering key topics for your next exam, Course Hero has the tools you need to achieve your goals.

9 Pages

### Analysis

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

Word Count: 1808

#### Document Preview

of Analysis Algorithms Input Algorithm Output An algorithm is a stepbystep procedure for solving a problem in a finite amount of time. Running Time (1.1) Most algorithms transform input objects into output objects. The running time of an algorithm typically grows with the input size. Average case time is often difficult to determine. We focus on the worst case running time. best case average case...

Register Now

#### Unformatted Document Excerpt

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

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.
of Analysis Algorithms Input Algorithm Output An algorithm is a stepbystep procedure for solving a problem in a finite amount of time. Running Time (1.1) Most algorithms transform input objects into output objects. The running time of an algorithm typically grows with the input size. Average case time is often difficult to determine. We focus on the worst case running time. best case average case worst case 120 100 Running Time 80 60 40 20 0 1000 2000 3000 4000 Easier to analyze Crucial to applications such as games, finance and robotics Analysis of Algorithms I nput Size 2 Experimental Studies ( 1.6) Write a program implementing the algorithm Run the program with inputs of varying size and composition Use a method like System.currentTimeMillis( ) to get an accurate measure of the actual running time Plot the results 9000 8000 7000 6000 5000 4000 3000 2000 1000 0 0 50 100 3 Time ( ms) I nput Size Analysis of Algorithms Limitations of Experiments It is necessary to implement the algorithm, which may be difficult Results may not be indicative of the running time on other inputs not included in the experiment. In order to compare two algorithms, the same hardware and software environments must be used Analysis of Algorithms 4 Theoretical Analysis Uses a highlevel description of the algorithm instead of an implementation Characterizes running time as a function of the input size, n. Takes into account all possible inputs Allows us to evaluate the speed of an algorithm independent of the hardware/ software environment Analysis of Algorithms 5 Pseudocode (1.1) Example: find max Highlevel description element of an array of an algorithm More structured than Algorithm arrayMax(A, n) English prose Input array A of n integers Less detailed than a Output maximum element of A program Preferred notation for currentMax A[0] for i 1 to n - 1 do describing algorithms if A[i] > currentMax then Hides program design currentMax A[i] issues return currentMax Analysis of Algorithms 6 Pseudocode Details Control flow Method call Return value Expressions var.method (arg [, arg...]) return expression Assignment (like = in Java) = Equality testing (like = = in Java) n2Superscripts and other mathematical formatting allowed 7 Method declaration if ... then ... [else ...] while ... do ... repeat ... until ... for ... do ... Indentation replaces braces Algorithm method (arg [, arg...]) Input ... Output ... Analysis of Algorithms The Random Access Machine (RAM) Model A CPU An potentially unbounded bank of memory cells, each of which can hold an arbitrary number or character 0 1 2 Memory cells are numbered and accessing any cell in memory takes unit time. Analysis of Algorithms 8 Primitive Operations Basic computations performed by an algorithm Identifiable in pseudocode Largely independent from the programming language Exact definition not important (we will see why later) Assumed to take a constant amount of time in the RAM model Analysis of Algorithms Examples: Evaluating an expression Assigning a value to a variable Indexing into an array Calling a method Returning from a method 9 Counting Primitive Operations (1.1) By inspecting the pseudocode, we can determine the maximum number of primitive operations executed by an algorithm, as a function of the input size Algorithm arrayMax(A, n) currentMax A[0] for i 1 to n - 1 do if A[i] > currentMax then currentMax A[i] { increment counter i } return currentMax Analysis of Algorithms # operations 2 2+n 2(n - 1) 2(n - 1) 2(n - 1) 1 Total 7n - 1 10 Estimating Running Time Algorithm arrayMax executes 7n -1 primitive operations in the worst case. Define: Let T(n) be worstcase time of arrayMax. Then a (7n -1) T(n) b(7n -1) Hence, the running time T(n) is bounded by two linear functions a = Time taken by the fastest primitive operation b = Time taken by the slowest primitive operation Analysis of Algorithms 11 Growth Rate of Running Time Changing the hardware/ software environment The linear growth rate of the running time T(n) is an intrinsic property of algorithm arrayMax Analysis of Algorithms 12 Affects T(n) by a constant factor, but Does not alter the growth rate of T(n) Growth Rates Growth rates of functions: In a loglog chart, the slope of the line corresponds to the growth rate of the function T (n ) Linear n Quadratic n2 Cubic n3 1E+30 1E+28 1E+26 1E+24 1E+22 1E+20 1E+18 1E+16 1E+14 1E+12 1E+10 1E+8 1E+6 1E+4 1E+2 1E+0 1E+0 Cubic Quadratic Linear 1E+2 1E+4 1E+6 1E+8 1E+10 n 13 Analysis of Algorithms Constant Factors The growth rate is not affected by Examples 102n + 105 is a linear function 105n2 + 108n is a quadratic function T (n ) constant factors or lowerorder terms 1E+26 1E+24 1E+22 1E+20 1E+18 1E+16 1E+14 1E+12 1E+10 1E+8 1E+6 1E+4 1E+2 1E+0 1E+0 Quadratic Quadratic Linear Linear 1E+2 1E+4 n 1E+6 1E+8 1E+10 Analysis of Algorithms 14 BigOh Notation (1.2) Given functions f(n) and g(n), we say that f(n) is 1,000 O(g(n)) if there are positive constants 100 c and n0 such that f(n) cg(n) for n n0 Example: 2n + 10 is O(n) 10,000 3n 2n+ 10 n 10 2n + 10 cn (c - 2) n 10 n 10/(c - 2) Pick c = 3 and n0 = 10 1 1 10 n 100 1,000 Analysis of Algorithms 15 BigOh Example Example: the function 100,000 n2 is not O(n) 1,000,000 n^ 2 100n 10n n n2 cn n c The above inequality be cannot satisfied since c must be a constant 10,000 1,000 100 10 1 1 10 n 100 1,000 16 Analysis of Algorithms More BigOh Examples 7n2 is O(n) need c > 0 and n0 1 such that 7n2 cn for n n0 this is true for c = 7 and n0 = 1 7n2 3n3 + 20n2 + 5 is O(n3) need c > 0 and n0 1 such that 3n3 + 20n2 + 5 cn3 for n n0 this is true for c = 4 and n0 = 21 3n3 + 20n2 + 5 3 log n + log log n 3 log n + log log n is O(log n) need c > 0 and n0 1 such that 3 log n + log log n clog n for n n0 this is true for c = 4 and n0 = 2 Analysis of Algorithms 17 BigOh and Growth Rate The bigOh notation gives an upper bound on the growth rate of a function The statement "f(n) is O(g(n))" means that the growth rate of f(n) is no more than the growth rate of g(n) We can use the bigOh notation to rank functions according to their growth rate f(n) is O(g(n)) g(n) grows more f(n) grows more Same growth g(n) is O(f(n)) No Yes Yes 18 Yes No Yes Analysis of Algorithms BigOh Rules If is f(n) a polynomial of degree d, then f(n) is O(nd), i.e., 1. 2. Use the smallest possible class of functions Drop lowerorder terms Drop constant factors Use the simplest expression of the class Analysis of Algorithms Say "2n is O(n)" instead of "2n is O(n2)" Say "3n + 5 is O(n)" instead of "3n + 5 is O(3n)" 19 Asymptotic Algorithm Analysis The asymptotic analysis of an algorithm determines the running time in bigOh notation To perform the asymptotic analysis Example: We find the worstcase number of primitive operations executed as a function of the input size We express this function with bigOh notation Since constant factors and lowerorder terms are eventually dropped anyhow, we can disregard them when counting primitive operations Analysis of Algorithms We determine that algorithm arrayMax executes at most 7n - 1 primitive operations We say that algorithm arrayMax "runs in O(n) time" 20 Computing Prefix Averages We further illustrate asymptotic analysis with two algorithms for prefix averages The ith prefix average of an array X is average of the first (i + 1) elements of X: A[i] = ( X[0] + X[1] + ... + X[i])/ (i+1) 35 30 25 20 15 10 5 0 1 2 3 4 5 6 7 X A Computing the array A of prefix averages of another array X has applications to financial analysis Analysis of Algorithms 21 Prefix Averages (Quadratic) The following algorithm computes prefix averages in quadratic time by applying the definition Algorithm prefixAverages1(X, n) Input array X of n integers Output array A of prefix averages of X #operations A new array of n integers n for i 0 to n - 1 do n s X[0] n for j 1 to i do 1 + 2 + ...+ (n - 1) s s + X[j] 1 + 2 + ...+ (n - 1) A[i] s / (i + 1) n return A 1 Analysis of Algorithms 22 Arithmetic Progression The running time of prefixAverages1 is O(1 + 2 + ...+ n) The sum of the first n integers is n(n + 1) / 2 7 6 5 4 3 2 1 0 1 2 3 4 5 23 Thus, algorithm prefixAverages1 runs in O(n2) time There is a simple visual proof of this fact 6 Analysis of Algorithms Prefix Averages (Linear) The following algorithm computes prefix averages in linear time by keeping a running sum Algorithm prefixAverages2(X, n) Input array ...

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 - 667
rqjp%s rbrup`uXju%s`7zjrrjpum} txyx`6`xqu%rwp3zXxurqjps u` pv t t q ~|{ w| x p t x rqje`s %rwrpj} %uwxyxwuq~ t u t t t rqj5jrr b5 xb3 ` rw%p`jv%w%Gs7t unuxqGjt%rwrptso t p s t x x 77xbd5 e eb rre
UMass (Amherst) - ECE - 665
Merge Sort7 2 9 4 2 4 7 9 7 2 2 7 7 7 2 2 9 4 4 9 9 9 4 4Merge Sort1Outline and ReadingDivideandconquer paradigm (4.1.1) Mergesort (4.1.1) Generic merging and set operations (4.2.1) Summary of sorting algorithms (
UMass (Amherst) - ECE - 665
Minimum Spanning Trees2704 867 849 ORD 1846 SFO 337 LAX 1464 DFW 1235 1121 MIA 2342 802 1391 740 621 187 JFK 184 BWI 1090 946 144 1258 BOS PVDMinimum Spanning Trees1Outline and ReadingMinimum Spanning Trees (7.3) The PrimJarnik Algorithm (
UMass (Amherst) - ECE - 665
ECE 697B (667)Spring 2003Synthesis and Verification of Digital Systems Technology Mapping I based on tree coveringSlides adopted (with permission) from A. Kuehlmann, UC Berkeley 2003ECE 667 - Synthesis &amp; Verification, Lecture 151Technology M
UMass (Amherst) - ECE - 665
ECE 665Spring 2005Computer AlgorithmsHint for Hm4, Problem 5ECE 665 - Homework41Modeling two-directional edges in Flow NetworksConstraint:the sum of the flows in both directions cannot exceed the capacity cSolution:add nodes and edges
UMass (Amherst) - ECE - 667
Satisfiabilityproblemof Booleanexpressionsin ConjunctiveNormalFormAlodeepSanyalElectricalandComputerEngineering UniversityofMassachusettsatAmherstSource: K. A. Sakallah (University of Michigan), S. Malik (Princeton University) and M. Ciesielski
UMass (Amherst) - ECE - 667
Design 1 -Vending machine - Mealy FSM (no reset) Input cond.PSNS-(!N).(!D)S0S0(N)S0S5(!N).(D)S0S10(!N).(!D)S5S5(N)S5S10(!N).(D)S5S15(!D).(!N)S10S10(D) + (N)S10S15 -S15S0--
UMass (Amherst) - ECS - 659
Interconnect Design for Secure MP-SoCIbis Benito, Sanghyun Lim, Sudarshan Narayanan and Sheng Xu Wayne Burleson and Guy Gogniat Department of Electrical and Computer Engineering University of Massachusetts, Amherst, Massachusetts {ibenito,slim,snara
UMass (Amherst) - ECS - 659
Interconnect design for Secure MP-SoC Midterm ReviewSang, Sheng, Ibis, Sudarshan ECE 659 - Advanced VLSI Design ProjectGlobal interconnect modelGeometry (70 nm vs. 45 nm)3.0 2.8 2.6 2.4 2.2 2.0 1.8 1.6 1.4 1.2 0.20 0.16 0.12 0.08 0.04Aspect
UMass (Amherst) - ECS - 659
Interconnect Design for Secure MP-SoCIbis D. Benito, Sanghyun Lim, Sudarshan Narayanan, Sheng XuECE 659 - Advanced VLSI Design Project1OutlineMP-SoC System Overview System specifications Wire modeling and technology concerns (San) Bus circui
UMass (Amherst) - ECS - 659
Interconnect Design for Secure MP-SOCProposal Slide ReviewIbis D. Benito Sanghyun Lim Sudarshan Narayanan Sheng XuOverall: Slide numbers have been added.ECE659 VLSI design Project Spring 2005Interconnect Design for Secure MP-SOCTeam members:
UMass (Amherst) - ECE - 659
`timescale 1ns / 10psmodule test;/ For 50Mhz, period is 20ns, so set CLKHI to 10 and CLKLO to 10parameter CLKHI = 10;parameter CLKLO = 10;/ Define some codes for each instruction opcode. These have nothing to do/ with the actual encoding o
UMass (Amherst) - CHE - 226
UMass (Amherst) - CHE - 120
R= T1 64.7 337.7 Have 2P,H,T1 T2 100 373 Need T2 372.13 Have 2T, H, P1 Need P2 1.11 Have 2T, 2P Need H 3.10 A K C K H 3.167 kJ/m0.008314 P1 1kJ/mK P2 1.111/(1/T1)-(R/DH)*ln(P2/P1).=EXP(1/T1-1/T2)*(DH/R)*(P1)kJ/m .=R*(lnP2/P1)/(1/T1)-(1/T2)
UMass (Amherst) - ECE - 665
Analysis of AlgorithmsInputAlgorithmOutputAn algorithm is a stepbystep procedure for solving a problem in a finite amount of time.What is algorithmApproaches to the efficient solutions to problems. Efficiency: How good is the solution Op
UMass (Amherst) - ECE - 665
Algorithms for longest prefix matching -Presentation for ECE665 Computer AlgorithmLiang Wang 05/05/20081Forecast In the current Internet routing system, IP address lookup is difficult because it requires a longest matching prefix search. In th
UMass (Amherst) - ECE - 665
PreLayout Clock Tree Synthesis Kelageri Nagaraj S# 22045170 ECE 665 Seminar Electrical and Computer Engineering Department University of Massachusetts AmherstObjectives Flexibility to optimize the clock tree earl
UMass (Amherst) - ECE - 665
Minimum Spanning Trees2704 867 849 ORD 1846 SFO 337 LAX 1464 DFW 1235 1121 MIA 2342 802 1391 740 621 187 JFK 184 BWI 1090 946 144 1258 BOS PVDMinimum Spanning Trees1Outline and ReadingMinimum Spanning Trees (7.3) The PrimJarnik Algorithm (
UMass (Amherst) - ECE - 665
Elementary Data StructuresStacks, Queues, &amp; Lists Amortized analysis TreesAbstract Data Types (ADTs)An abstract data type (ADT) is an abstraction of a data structure An ADT specifies: Example: ADT modeling a simple stock trading system
UMass (Amherst) - ECE - 665
DynamicProgrammingDynamicProgramming1OutlineandReadingFuzzyExplanationofDynamicProgramming Introductoryexample:MatrixChainProduct (5.3.1) TheGeneralTechnique(5.3.2) Averygoodexample:01KnapsackProblem (5.3.3)DynamicProgramming2MatrixChain
UMass (Amherst) - ECE - 697
EndtoEndRoutingBehaviorProf.Gao ECE697JSpring2005 AdvancedComputerNetworksHowRoutingSystem Performs MeasuringEndtoEnd?EndtoendbehaviorEndtoendpathUsingtracerouteConformancewithcontrolplane observationConsistencybetweenendtoend
UMass (Amherst) - ECE - 122
ECE 122April 19, 2005Are you tired of Console I/O yet? We should have something fun. Something graphical, response with a click of a button, even animationsJava GUI What is GUI? Graphical User Interface It is so intuitive, and easy to use.
UMass (Amherst) - ECE - 122
W e toJavaProgram ing elcom mW doI w totake this course? hy ant I want to major in EE/CSE. ECE122 is a requirement. Java is hot in Job market. It is useful for my career. My friends are taking this course. I am just curious.EC C W Site E122 o
UMass (Amherst) - ECE - 122
ECE122March 29, 2005Another Example of Inheritance I want to write classes of medical doctors. One is family practitioner, one surgeon. How many classes do I need? What are they? Can I use inheritance? What should I put in super class? What
UMass (Amherst) - ECE - 122
ECE122April 28, 2005More Graphics Components JLabel JTextField JCheckBox JRadioButtonJLabel A JLabel displays a single line of read-only text, an image, or both text and an image. Demo Label.javaJTextField &amp; JPasswordField JTextField &amp;
UMass (Amherst) - ECE - 122
ECE122 Quiz #1 Open books, open notes, No computer. Question 1: Which of the following is NOT right for Java programming language? 1. 2. 3. 4. Object oriented Platform dependent Garbage collected Multi-threadedAnswerWeve mentioned that Java is pla
UMass (Amherst) - ECE - 122
Welcome to Java ProgrammingWhy do I want to take this course? I want to major in EE/CSE. ECE122 is a requirement. Java is hot in Job market. It is useful for my career. My friends are taking this course. I am just curiousECE122 Course Web Sit
UMass (Amherst) - ECE - 122
ECE 122April 14, 2005I/O stream Java performs I/O through streams. A stream is linked to a physical device by the Java I/O system. All stream behave in the same manner, even if the actual physical device is different. Same I/O classes and meth
UMass (Amherst) - ECE - 122
ECE 122April 26, 2005Inner Class An inner class is a class defined within another class. An inner object is bonded with its external object. The inner object has access to all (both public and private) the variables and methods of the external
UMass (Amherst) - ECE - 122
ECE 122Exception Handling Exception handling provides a graceful way of handling exceptional cases and errors. The system will not crash when such exception happens. The control will be transferred to exception handling code, which will correct th
UMass (Amherst) - ECE - 122
ECE122April 28, 2005More Graphics Components JLabel JTextField JCheckBox JRadioButtonJLabel A JLabel displays a single line of read-only text, an image, or both text and an image. Demo Label.javaJTextField &amp; JPasswordField JTextField &amp;
UMass (Amherst) - ECE - 122
UMass (Amherst) - ECE - 122
ECE 122 Spring 2005 SampleExam #1 Name_ Student ID_ Discussion Session (circle one): (1) Wednesday 10:10am 11am (2) Wednesday 11:15am 12:05pm (3) Wednesday 1:25pm-2:15pm (4) Wednesday 2:30pm-3:20pm Q1 What is the output of the following code? publi
UMass (Amherst) - ECE - 122
1. Most students did very well this time. Most required functions are implemented, and many completed the extra points section.2. Still there are several groups forgot to submit the supporting classes. 10 points were deducted according t
UMass (Amherst) - ECE - 122
Account Project4= =A36563 100A37395 70A73448A93030 0B15582B30534 100B62000 100B63878 100B87334 60C05516C07107 90C16660C31579 80C76512
UMass (Amherst) - ECE - 122
Account Project6= =A36563A37395 90A73448A93030 100B15582B30534 110B62000 110B63878 100B87334 107C05516C07107 110C16660C31579C76512 110C92057
UMass (Amherst) - ECE - 122
Grading Policy:There are 100 points total for this project: - 10 points are deducted if missing any required files. - The dialog should have the required interface, and the required functions should work properly. (80 points) -
UMass (Amherst) - ECE - 122
Grading Scheme:Grading Crietria: Basic requirement: total 100 points. Extra requirment: total 13 points 1. check duplicated SID 3 points 2. Use array directly 10 pointsIf your program cannot be comp
UMass (Amherst) - ECE - 122
Grading Crietria: Basic requirement: total 100 points. 1. project1a 50 points 2. project1b 50 points Extra requirment: total 10 points 1. readDouble 5 points 2. readString
UMass (Amherst) - ECE - 122
Account Project2=A36563 75A37395A73448A93030 60B15582B30534 105B62000 105B63878B87334 110C05516C07107 103C16660C31579 100C76512 110C92057 100D08322 100D14101D78830 110D847
UMass (Amherst) - ECE - 122
Grading Scheme:Grading Crietria: Basic requirement: 1. Course.java2. Student.java Extra requirment: total 10 points 1. printStudents method (Either a 0 or a 10) If your program cannot be compiled succesfully,
UMass (Amherst) - ECE - 122
Account Project3= =A36563 100A37395 90A73448A93030 110B15582B30534 110B62000 110B63878B87334 100C05516C07107 100C16660C31579 50C76512 85C9
UMass (Amherst) - ECE - 122
General comments:1. Many students did not submit Constant.java, NegatePipe.javaand Pipe.java with their work. Your Programs will not compileunless you submit them. We had to supply the necessary classfiles to compile them. Though, they have not
UMass (Amherst) - ECE - 122
About grading:1. Some students' programs do not compile. According to the grading policy, you should have got 0s. 2. Many students did not submit the SID in their codes. Please do so from next time.3. If there was no proper documentation, you wi
UMass (Amherst) - ECE - 122
General comments:1. Many students did not have graduateDate variable and its set/get methods in Student.java. Some of them did not have set/get methods to access private variables in Student.java/Teacher.java/Course.java.2. Some students did not
UMass (Amherst) - ECE - 122
About grading:1. Some students' programs do not compile. According to the grading policy, you should have got 0s. However, dependingon how well your code was written, we gave 50 - 70 points for your effort. Next time we may strictly follow the
UMass (Amherst) - ECE - 122
Grading Crietria: Basic requirement: 1. Part(a): 50 points. 2. Part(b): 50 points. Extra requirment: total 10 points 1. getUniqueStudentId method to return an unique integer as student ID. If your program doe
UMass (Amherst) - ECE - 122
Account Project5= =A36563A37395 100A73448A93030 100B15582B30534 100B62000 100B63878 65B87334 85C05516C07107 100C16660C31579 95C76512 100C92057 100D08322
UMass (Amherst) - ECE - 122
Grading Crietria: Basic requirement: 1. Part(a): 40 points. 2. Part(b): 60 points. Extra requirment: total 10 points 1. doPipeline method in SingleInputPipe.java If your program does not conform to the require
UMass (Amherst) - ECE - 122
public int dayOfYear() { int total = 0; for (int m=1; m &lt; _month; m+) { total += daysInMonth(_year, m); } return total + _day; }
UMass (Amherst) - ECE - 122
ECE 122Feb. 3, 2005Java Data Types Primitive types. boolean, byte, char, short, int, long, float, double Reference Type. Class.boolean 1 bit of data. Can only be of two value, true or false Declaration: boolean b; Assignment: b = true; b
UMass (Amherst) - ECE - 122
ECE 122Feb. 1, 2005Introduction to EclipseJava Statements Declaration Assignment Method callsDeclaration A variable is like a container that can hold certain content/value. Variable declaration consists of type and name Variable name, by
UMass (Amherst) - ECE - 122
ECE 122March 24Motivation I am tasked to write two classes, one for cat, one for sheep. That is easy. I roll up my sleeve and get it done!Here is my class for catimport java.io.*;/importing java I/O package public class Cat1 { File imageFile;
UMass (Amherst) - ECE - 122
UMass (Amherst) - ECE - 122
ECE122 Quiz #1 Open books, open notes, No computer. Question 1: Which of the following is NOT right for Java programming language? 1. 2. 3. 4. Object oriented Platform dependent Garbage collected Multi-threadedQuestion 2: How do you invoke a Java v
UMass (Amherst) - ECE - 122
ECE 122JList Demo JListDemo.javaMouse Event Handling MouseListener MouseMotionListener MouseInputListener. Extends interfaces of both MouseListener and MouseMotionListener to create a single interfaceMethods of MouseListener public voi
UMass (Amherst) - ECE - 122
ECE 122April 12, 2005Look closer at Animal class We can instantiate an Animal object: Animal a = new Animal(); However, what does such an animal object looks like and behaves?We need Animal class, but not generic animal object We still needs
UMass (Amherst) - ECE - 122
ECE 122Feb. 8, 2005if Statement A condition is an expression that can be either true, or false. if statement allows a program to make a decision based on the value of a condition.Equality Operators = e.g. x=y != e.g. x!=y means x is equal to
UMass (Amherst) - ECE - 122
ECE122Feb 10, 2005Unary Operator An operator that takes only a single operand Plus: + Minus: Cast: (type). E.g. (double)Compound Assignment OperatorOperator += -= *= /= %= Example x += y x -= y x *= y x /= y x %= y Meaning x=x+y x=x-y x=x
UMass (Amherst) - ECE - 122
ECE 122We know thisCat cat = new Cat(); Animal animal = new Animal();and this? Animal animal = new Cat(); An object reference of super class type points to an object of sub class type. It is legal and it is called polymorphism.Motivation L
UMass (Amherst) - ECE - 122
ECE 122April 19, 2005Are you tired of Console I/O yet? We should have something fun. Something graphical, response with a click of a button, even animations.Java GUI What is GUI? Graphical User Interface It is so intuitive, and easy to use