1 Page

lec27March1408

Course: COMP 202, Winter 2008
School: McGill
Rating:
 
 
 
 
 

Word Count: 154

Document Preview

27 March Lecture 27, 2008 ArrayList ArrayList band = new ArrayList() band.add ("Paul"); Band.add("John"); ... int location = band.indexOf("Paul"); Band.remove(location); An ArrayList is not declared to store a particular type An Arraylist object dynamically grows and shrinks Any type of object can be stored in it ArrayList() boolean add(Object obj) void...

Register Now

Unformatted Document Excerpt

Coursehero >> Canada >> McGill >> COMP 202

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.
27 March Lecture 27, 2008 ArrayList ArrayList band = new ArrayList() band.add ("Paul"); Band.add("John"); ... int location = band.indexOf("Paul"); Band.remove(location); An ArrayList is not declared to store a particular type An Arraylist object dynamically grows and shrinks Any type of object can be stored in it ArrayList() boolean add(Object obj) void add(int index, Object obj) Object remove(int index) Object set(int index, Object obj) void clear() boolean contains(Object obj) int obj) indexOf(Object Object get(int index) boolean isEmpty() int size() An ArrayList is a generatic type Allows us to the type of data The compiler will not allow an object to be added unless it's of this specified type ArrayList<String> myList = new ArrayList<String>(); ArrayList<Point> myList = new ArrayList<Point>(); Declaring the element type of an ArrayList is usually a good idea: Type-checking Eliminates the need to cast an object into its true type In class example ...
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:

McGill - COMP - 202
Lecture 29March 19, 2008Exceptions Used to handle errors and other exceptional events An event which occurs during the execution of a program that disrupts the normal flow of the program's instructions An exception is an object that describes a
McGill - COMP - 202
Lecture 31March 26, 2008&quot;#$%&amp;'()*+, -%$./*(+0!1)2!2%&amp;)2'(*3!/*4!./*45(*3! %22)2+!(*!&amp;2)32/0+ , 6.%*!/*!%22)2!)$72+8!'.%!&amp;2)32/0! '.2)9+!/*!%#$%&amp;'()* , :.%!%#$%&amp;'()*!(+!&amp;2)&amp;/3/'%4!7&amp;!! !&quot;#$%&amp;'&amp;()$*+ ,-.!./0.%()$*!)1!%#$%&amp;'&amp;(.23 4)#1(!($!(-.!5
McGill - COMP - 202
!&quot;#$%&amp;'()*+,)*()*- ./0$%1*$(123 ,($'%4%5&quot;#$%4'6%70$4*$%4'%89:$7*%*/4*%;$%;&quot;#% )1$%*8%477$11%&quot;* 3 &lt;1$%*/&quot;1%89:$7*%*8%$&quot;*/$0%0$46%64*4%508=%*/$%5&quot;#$% 80%;0&quot;*$%64*4%*8%&quot;* 3 &gt;#81$%*/$%5&quot;#$?$46&quot;'@%.$A*%!&quot;#$1- &gt;/$7B$6%$A7$(*&quot;8'13 C%5&quot;#$%0$#4*$6%477$1
Vanderbilt - EECE - 112
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Two Solutions10 March 20062.(a) 1 MW (b) 12.35 mm (c) 47. kW (d) 5.46 mA(e) 33 J (f) 5.33 nW (g) 1 ns (h) 5.555 MW(i) 32 mmPROPRIETARY MATERIAL. 2007 The McGraw-Hill Companies, Inc. Limi
Vanderbilt - EECE - 112
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Eight Solutions10 March 200674. (a) (b) (c) ix (0- ) = 30 3 = 3A, iL (0- ) = 4A 7.5 4ix (0+ ) = iL (0+ ) = 4Aix () = iL () = 3A ix (t ) = 3 + 1e-10t / 0.5 = 3 + e-20t A ix (0.04) = 3 + e-0
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Eight Solutions10 March 200626. (a) (b) 1 2 iL (0- ) = 60 = 30 mA, ix (0- ) = 30 = 20 mA 2 3iL (0+ ) = 30 mA, ix (0+ ) = -30 mA(c)iL (t ) = 30e-250t / 0.05 = 30e-5000t mA, iL (0.3ms) = 30
Vanderbilt - EECE - 112
(b)
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Eleven Solutions10 March 200631. (a)v = 10 + 9 cos100t + 6sin100t 1 1 Veff = 100 + 81 + 36 = 158.5 = 12.590 V 2 2(b)Feff =1 2 (10 + 202 + 102 ) = 150 = 12.247 4(c)Favg =(10)(1) +
Vanderbilt - EECE - 112
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Eleven Solutions10 March 200649.Vx - 100 V V - j100 + x + x =0 6 + j4 - j10 5 1 100 Vx + j 0.1 + 0.2 = + j 20 6 + j4 6 + j4 Vx = 53.35- 42.66 V 100 - 53.35- 42.66 I1 = = 9.806 - 64.44
Vanderbilt - EECE - 112
Correction: The answer for the power of the two resistors is correct, but the formula used isn't right. Only the voltage should be squared, not both the voltage and the resistance. So it should be: P = .5 * (52.442/5) * cos(50) P = .5 * (52.442/8) *
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Ten Solutions10 March 200641. (a) = 800 : 2F - j 625, 0.6H j 480 Zin = 300(- j 625) 600( j 480) + 300 - j 625 600 + j 480 = 478.0 + j175.65 300(- j 312.5) 300 - j 312.5(b) = 1600 : Zin =
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Ten Solutions10 March 200622.(a) 7 -90o = -j 7 (b) 3 + j + 7 -17o = 3 + j + 6.694 j 2.047 = 9.694 j 1.047 (c) 14ej15 = 14 15o = 14 cos 15o + j 14 sin 15o = 13.52 + j 3. 623 (d) 1 0o = 1 (
Vanderbilt - EECE - 112
Vanderbilt - EECE - 112
it should still be 44.23
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Eleven Solutions10 March 20061.50 (- j80) 106 = - j80 , = 42.40 - 32.01 j 500 25 50 - j80 V = 84.80 - 32.01 V, I R = 1.696 - 32.01 A Zc = I c = 1.060057.99 A ps ( / 2ms) = 84.80 cos (45 - 32.0
Vanderbilt - EECE - 112
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Four Solutions10 March 200617.Choosing the bottom node as the reference terminal and naming the left node &quot;1&quot;, the center node &quot;2&quot; and the right node &quot;3&quot;, we next form a supernode about nodes 1
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Two Solutions10 March 200626.The supply voltage is 110 V, and the maximum dissipated power is 500 W. The fuses are specified in terms of current, so we need to determine the maximum current tha
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Two Solutions10 March 200615.(a) Pabs = (+3.2 V)(-2 mA) = 6.4 mW (b) Pabs = (+6 V)(-20 A) = 120 W(or +6.4 mW supplied)(or +120 W supplied)(d) Pabs = (+6 V)(2 ix) = (+6 V)[(2)(5 A)] = +60
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Three Solutions10 March 20062.(a) six nodes; (b) nine branches.PROPRIETARY MATERIAL. 2007 The McGraw-Hill Companies, Inc. Limited distribution permitted only to teachers and educators for co
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Three Solutions10 March 200645.(a) Applying KCL, 1 i 3 + 3 = 0so i = 1 A.(b) Looking at the left part of the circuit, we see 1 + 3 = 4 A flowing into the unknown current source, which, by
Vanderbilt - EECE - 112
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Eight Solutions10 March 20061.i (t ) = i (0)e-R t L= 2e -4.710 t mA9(a) i(100 ps) = 2e-4.7109 10010-12()= 1.25 mA(b) i(212.8 ps) = 2e (c) vR = iR-4.7109 212.810-12()= 7
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Seven Solutions10 March 200631. C equiv 1 1 in series with 10 in series with 10 + 10 + 1 1 1 1 10 + 10 10 + 10 4.286FPROPRIETARY MATERIAL. 2007 The McGraw-Hill Comp
Vanderbilt - EECE - 112
Vanderbilt - EECE - 112
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Seven Solutions10 March 20066.(a)For VA = 1V, W =-12 2K s 0 . (Vbi - V A ) = 2(11.8) 8-854 10 24 (0.57 + 1) qN 1.6 10 19 1 10(()() )= 45.281 10 Cj =-9m11.8 8.854 10 -12
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Six Solutions10 March 200610.This is again a non-inverting amplifier. Similar to question 9, we have:a) Vout = 200m (1 + 4.7) = 1.14 V b) Vout = (1 + 1) 9 = -18 V c) Vout = 7.8 100m = 0.78
Vanderbilt - EECE - 112
Vanderbilt - EECE - 112
(b) Connecting a 10resistor, + 10 = ) = 3.33 AIload = VTH/(RTH+10 ) = 75 V/(12.5 Pload = Iload2 * 10 = (3.33 A)2 * 10 resistor,111 W(c) Connecting a 75Iload = VTH/(RTH+75 ) = 75 V/(12.5 Pload = Iload2 * 75 = (.857 A)2 * 75+ 75 =) = .857
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Five Solutions10 March 200642.(a) Replacing the 7 resistor with a short circuit, we find ISC = 15 (8)/ 10 = 12 A. Removing the short circuit, and open-circuiting the 15 A source, we see that R
Vanderbilt - EECE - 112
Engineering Circuit Analysis, 7th EditionChapter Five Solutions10 March 20063.Open circuit the 4 A source. Then, since (7 + 2) | (5 + 5) = 4.737 , we can calculate v1 = (1)(4.737) = 4.737 V. To find the total current flowing through the 7 r
Vanderbilt - EECE - 112
Vanderbilt - EECE - 112
Vanderbilt - EECE - 112
UCLA - BIO CHEM - 153A
Seat # _ Last initial _ Chemistry and Biochemistry 153A Practice Midterm Examination KEY_KEY_ Print your full name (last name first) Question # 1 2 3 4 5 6 7 8 TOTAL Value 23 23 20 10 11 25 10 30 152 __ SignatureINSTRUCTIONS READ EACH QUESTION CAR
Washington - CSE - 100
TEAM LinGBeginning AlgorithmsBeginning AlgorithmsSimon Harris and James RossBeginning AlgorithmsPublished by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Published 2006 by Wiley Publishing, Inc., Indi
U. Houston - BIOL - 1362
1362 Spring 07 Exam 1 YELLOW VERSION 1. Which of the following is not correct concerning interphase? A) A functioning cell that has not received a stimulus to divide spends its time in G1 and may go into G0. B) DNA synthesis is completed prior to the
U. Houston - BIOL - 1362
Exam 2 Spring 2007 Biol 1362 PINK VERSION 1. Which A) B) C) D) E) Ans: 2. All are A) B) C) D) E) Ans:Bubble in name (last name first). Bubble in last 4 digits of student ID # in boxes G-H-I-J. Write color of exam above your name.of the following
U. Houston - BIOL - 1362
BIOL 1362 Exam 3 Spring 2007 BLUE 1. Which of the following statements is true about natural selection? A) Natural selection acts by preserving traits acquired during an individual's lifetime. B) Natural selection acts on the phenotypic variation in
U. Houston - BIOL - 1362
Spring 07 1362 Exam 4 WHITE 1. Although primary producers can capture light (solar) energy to fix CO2, they are absolutely dependent upon the _ to provide them with usable forms of nitrogen and minerals. A) carnivores B) decomposers C) autotrophs D)
UCSD - ECON - 120A
Economics 120A July 14, 2003Name: _key_ Student ID#: _ ANSWER to Midterm Exam: Econometrics1. (10 points) An investment councilor recently reviewed the account activity of 10 of his clients. He was interested in the average number of stock trades
UCSD - ECON - 120A
Economics 120A July 30, 2003Name: _key_ Student ID#: _ ANSWER to Final Exam: Econometrics1.(10 points) The stamping machine on a production line periodically is taken off-line for maintenance. Assume that the amount of time the machine is off-lin
UCSD - ECON - 120A
Economics 120A Professor Yongil Jeon Summer 2006Name: _ Student ID#: _Answer to Homework #1 Summer 2006 (Answer to Midterm Exam, Summer 2005)1-a. (3 points) The probability of an event A or B (Pr(A B) to occur equals a. Pr(A) Pr(B). b. Pr(A)
UCSD - ECON - 120A
Economics 120A Professor Yongil Jeon Summer 2007Name: _answer_ Student ID#: _ Answer to Homework #1 Summer 2007(Midterm Exam, Summer 2006)Answer all questions on separate paper. This problem set should be handed in to TA Deniz Kebabci at the be
UCSD - ECON - 120A
Economics 120A Professor Yongil Jeon Summer 2005Name: _ Student ID#: _Answer to Homework #1 (Midterm Exam, Summer 2004)1. (10 points) Columbia House provides CDs and tapes to its mail-order club members. A Columbia House Music Survey asked new c
UCSD - ECON - 120A
Economics 120A Professor Yongil Jeon Summer 2006Name: _ Student ID#: _Answer to Homework #2 Summer 2006 (Answer to Final Exam, Summer 2005)Answer all questions on separate paper. This problem set should be handed in to Professor Jeon at the beg
UCSD - ECON - 120A
Economics 120A Professor Yongil Jeon Summer 2007Name: _answer_ Student ID#: _ Answer to Homework #2 Summer 2007(Final Exam, Summer 2006)Answer all questions on separate paper. This problem set should be handed in to TA Deniz Kebabci at the begi
UCSD - ECON - 120A
Economics 120A Professor Yongil Jeon Summer 2005Name: _ Student ID#: _Answer to Homework #2 (Final Exam, Summer 2004)1. (10 points) Given that z is a standard normal random variable, compute the following probabilities (a) (3 points) P(-1.98 z
UCSD - ECON - 120B
Economics 120B Professor Yongil Jeon Winter 2008Name: _ Student ID#: _Homework #3, Winter 2008 (Part of Exam 2, Summer 2006)Answer all questions on separate paper. This problem set should be handed in to your TA at the beginning of the discussio
UCSD - ECON - 120A
Economics 120A Professor Yongil Jeon Winter 2008Name: _ Student ID#: _Answer to Homework #1 Winter 2008 (Part of Midterm Exam, Summer 2007)1. True/False (4 points each) 1. The optimal solution to a mathematical model is always the policy that s
UCSD - ECON - 120B
Economics 120B Professor Yongil Jeon Winter 2008Name: _ Student ID#: _Answer to Homework #1, Winter 2008 (Part of Exam 1, Summer 2006)Answer all questions on separate paper. This problem set should be handed in to Professor Jeon at the beginning
UCSD - ECON - 120A
Economics 120A Professor Yongil Jeon Winter 2008Name: _ Student ID#: _Answer to Homework #2 Winter 2008 (Part of Midterm and Final Exams, Summer 2007) Answer all questions on separate paper. This problem set should be handed in to Professor Jeon
UCSD - ECON - 120B
Economics 120B Professor Yongil Jeon Summer 2006Name: _ Student ID#: _Answer to Homework #2, Summer 2006 (Exam 2, Summer 2005)1-a. (5 points) A nonlinear function a. makes little sense, because variables in the real world are related linearly. b
UCSD - ECON - 120A
Economics 120B Professor Yongil Jeon Summer 2005Name: _ Student ID#: _Answer to Homework #2 (Exam 2, Spring 2005)1. (10 points) Comment on the following statement (that is, under what conditions is it true?). The yield per acre of corn is regre
UCSD - ECON - 120A
Economics 120A Professor Yongil Jeon Winter 2008Name: _ Student ID#: _Answer to Homework #3 Winter 2008 (Part of Final Exam, Summer 2007)Answer all questions on separate paper. This problem set should be handed in to Professor Jeon at the begin
UCSD - ECON - 3
C h a p t e r5MEASURING GDP AND ECONOMIC GROWTH*Solutions to the Odd-Numbered Problems1. a. Aggregate expenditure is $10,198 billion. Aggregate expenditure is the sum of consumption expenditure, investment, government expenditure, and net expo
UCSD - ECON - 3
C h a p t e r1WHAT IS ECONOMICS?Solutions to the Odd-Numbered Problems1. a. Tunes remain scarce because even with iTunes making tunes feely available, many people do not own iPods and so cannot enjoy music away from their computers. In additio