Lec 5

Announcements

Goals • Branches • Logical operations • Quiz

if statements

if else statements

Syntax if (condition) { //code } //rest of program

Syntax if (condition) { //code } else { //code }

What gets printed? i=10; j=5; z=2; i=10; j=5; z=2; if(i == 10) { if(i == 10) if(i > j) if(i > j) z *= 2; z *= 2; else } z *= 4; else { System.out.println(“z=“ + z); z *= 4; } System.out.println(“z=“ + z);

A) z=2 z=2

B) z=4 C) z=4 z=4 z=8

D)z=2 z=8

E)z=8 C.E.

if – else-if

if else-if syntax if (condition) { //code } else if (condition) { //code } else if (condition) { //code } else { //code }

Conditions • <, >, <=, >=, ==, != – Note: =>, =<, =! Will give compiler errors

• = is not the same as ==

Order of operations ()

Compute anything inside 1st

! pre ++ -- (e.g. ++var, --var)

Left to right

Type cast

Left to right

* / %

Left to right

+ -

Left to right

< <= > >=

Left to right

== !=

Left to right

&& ||

Left to right

=

assignment

post ++ -- (e.g. var++, var--)

Left to right

()

! pre ++ -- (e.g. ++var, --var) Type cast * / %

What’s the value of exp1?

+ < <= > >=

int a = int b = int c = boolean a) true

7; -1; 2; exp1 = !(a + b * c >= a + c * b); b) false

c) C.E.

d) False

== != && || = post ++ -- (e.g. var++, var--)

e) B and D are the same

Logical Operators a && b -- a AND b. both must be true a || b – a OR b. One or both must be true !a – NOT a. flips a

Which of these evaluates to true int i =10; char c=‘A’; a) i > 10 || i < 20 b) !(i > 10 && i < 20) c) i*7+c/2 > 34 || c == ‘A’ d) a and c e) All of the above

Lec 2

Compute anything inside 1st ! pre ++ -- (e.g. ++var, --var) Left to right. Type cast. Left to right. * / %. Left to right. + -. Left to right. < <= > >= Left to right. == != Left to right. && ||. Left to right. = assignment post ++ -- (e.g. var++, var--). Left to right. Page 14. What's the value of exp1? int a = 7; int b = -1; int c = 2; boolean exp1 = !(a + ...

214KB Sizes 0 Downloads 146 Views

Recommend Documents

LEC Dietary Requests (optional).pdf
There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. LEC Dietary ...Missing:

Microprocessor and Microcontroller - Lec 1
Introduction. 2. 8051Microcontroller. • Architecture and Hardware. 3. • Assembly Language. 4. • Assembly Language Contd. 5. • Timers and Counters. 6. • Serial Port. 7. • Interrupt. 8, 9. • Design and Interface Examples. 10. Midterm Exam

Reconstruction Urdu-Lec-6.pdf
قومی شاعر، جدید مسلم فالسفر، مفکر، دانشور اور قانون دان. کےعالوہ بانیان ... The Conception of God and the Meaning of Prayer ... Reconstruction Urdu-Lec-6.pdf.

Lec-9 Convolutiona Turbo TCM.pdf
Page 1 of 6. 11/29/2013. 1. Convolutional Codes. Nikesh Bajaj. [email protected]. Asst. Prof., ECE Dept. Lovely Professional University. Advance Coding ...

CUT-OFF LEC & JRF.pdf
Loading… Whoops! There was a problem loading more pages. Retrying... Whoops! There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. Main menu. Whoops! There was

Reconstruction Urdu-Lec-6.pdf
قومی شاعر، جدید مسلم فالسفر، مفکر، دانشور اور قانون دان. کےعالوہ بانیان پاکستان میں بھی شامل ہیں. ان کی شا عری بہت. مشہور ہے مگر مسلمانوں Ú©Û

Peterson - SIOP LEC 2017 - future of coaching 2017.10.20.pdf ...
Page 3 of 70. 3. Imagining the future of executive coaching. David B. Peterson, PhD. [email protected]. october two zero, two zero one seven.

Lec-4 Linear Block Codes v5.pdf
Please enter this document's password to view it. Password incorrect. Please try again. Submit. Lec-4 Linear Block Codes v5.pdf. Lec-4 Linear Block Codes v5.

LEC Student Handbook 2015-16.pdf
The Lincoln Education Center is a separate site educational program, providing special education services for. students with emotional and behavioral disorders ...

June 2014 CUT-OFF LEC & JRF.pdf
Loading… Whoops! There was a problem loading more pages. Whoops! There was a problem previewing this document. Retrying... Download. Connect more apps... Try one of the apps below to open or edit this item. Main menu. There was a problem previewing

list_new2_Pdf (2)(2) (2).pdf
C/O. NAGRAJ K., TELECOM SECTION,. KDHP CO. (P) LTD, MUNNAR WORKSHOP,. P.O. MUNNAR, IDUKKI - 685 612. 5 BITHAMOL K.T., AGED 32 YEARS,.

(2)(2) (2).pdf
THE STATE OF KERALA,. REPRESENTED BY THE SECRETARY TO GOVERNMENT,. EDUCATION DEPARTMENT,THIRUVANANTHAPURAM, PIN- 695 001. 2. THE STATE PROJECT DIRECTOR,. RASHTRIYA MADHYAMIK SHIKSHA ABHIYAN,. SEVENTH FLOOR, TRANS TOWER BUILDING,. VAZHUTHACAUD ...

1/2 index.html 2/2 - CS50 CDN
20: . 21: CS50 Shuttle. 22: . 23: . 24:

2
Approaches that depart from the nested features used in back-off n-gram LMs ... The loss function optimized in training is the cross-entropy between the model ...

2 ;...; g 2
Wireless communication networks are widely deployed today, and for many ..... for a similar example) without loss of optimality and the advantage is that (19) ...

2-2-rmqmo.pdf
Halogen-free according to IEC61249-2-21. • Double sided cooling. • Compatible with DirectFET® package MZ footprint and outline. • Low parasitic inductance.

2-2 Finanzas.pdf
3.1 Los flujos de renta frente a los flujos de caja. 3.2. Tipos de flujos de caja. 3.3. La estimación del flujo de caja. 3.4. El cálculo del flujo de caja libre de la ...

2-2.pdf
planned and hysterectomy was performed because of sus- pected endometrial cancer. ... with endometrial polyp by pathology consultation. Page 3 of 4. 2-2.pdf.

2-2 Finanzas.pdf
Módulo Formación Transversal Materia Gestión. Empresarial. Carácter Obligatorio. Créditos 6. Presenciales 3,6. No presenciales 2,4. Curso 2 Semestre 4.

CS_Phoenix Power Company SAOG Financials (2)(2)(2)(1).pdf ...
POMCo Phoenix Operation and Maintenance Company LLC 1) Minimum DSCR requirement is 1.05. Financial modeling (refer the attached excel file) shows the project cash flow is hard to meet. LTMC Long Term Maintenance Contract this without deferred tax and

ajax1.html 1/2 ajax1.html 2/2 - CS50 CDN
3: ajax1.html. 4: 5: Gets stock quote from quote1.php via Ajax, displaying result with alert(). 6: 7: Computer Science 50. 8: David J. Malan. 9: 10: -->. 11: 12: