



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




Larry Caretto Computer Science 106
2
3
, <=, >=, ==, !=) and logical operators not(!) and(&&) or(||)
4
5
6
7
( )
() ( 1 ) 2 2 n
n n x
x A x + = +
( 1 ) 1 2
( 1 ) ( 1 ) ()
( 1 ) () 2 2
n n untilx x x x
x A x ε ε
9
if ( month == 4 || month == 6 || month == 9 || month == 11 ) { days = 30; } else if ( month == 2 ) { if (leapYear) // bool var { days = 29; } // continue on next chart
11
else { days = 28; } } // ends else if (month==2) else { days = 31; }
12
19
20
if ( month == 4 || month == 6 || month == 9 || month == 11 ) { days = 30; } else if ( month == 2 ) { if (leapYear) // bool var { days = 29; } // continue on next chart
21
else { days = 28; } } // ends else if (month==2) else { days = 31; }
22
if ( month == 4 || month == 6 || month == 9 || month == 11 ) days = 30; else if ( month == 2 && leapYear ) days = 29; else if ( month == 2 ) days = 28; else days = 31;
At this else-if we know that if month equals two it is not a leap year. Why?
23
25
if (status == “undgrd” ) { if (units >= 12 && gpa >= 3.5 ) deansList = true; else if ( units >= 6 && gpa >= 3.7 ) deansList = true; else deansList = false; } else deansList = false;
27
deansList = status == “undgrd” && ( ( units >= 12 && gpa >= 3.5 ) || ( units >= 6 && gpa >= 3.7 ) );