2. Core Programming Understand computerstorage and data types Understand computerdecision structures Identify the appropriatemethod for handlingrepetition Understand errorhandling
3. Understand computer decision structures Lesson Overview Students will understand the decision structures used by computers. In this lesson, you will learn: Various decision structures used in all computer programming languages if decision structures Multiple decision structures such as if…else and switch/Select Case Reading flowcharts Decision tables Evaluating expressions
11. Understand computer decision structures Relational Expressions A relational operator is used to compare two values, resulting in a relational expression. For example: number > 16 grade == ‘F’ passing >= 60 A list of relational operators: < less than > greater than <= less than or equal to >= greater than or equal to == equal to != not equal to
16. Understand computer decision structures Decision Table A concise way of demonstrating logic Creates an association between conditions and actions to execute
17. Assignment 1 boolisFun = F; boolisKind = F; boolisPopular = T; if isFun && isKind || isPopular; Console.WriteLine("You are my friend."); else Console.WriteLine("Who are you?");
18. Answer 1 boolisFun = false; boolisKind = false; boolisPopular = true; if (isFun && isKind || isPopular) Console.WriteLine("You are my friend."); else Console.WriteLine("Who are you?");
19. Assignment 2 1. You set the high score in Donkey Kong if your score is over 1,050,200 points. if (score > 1050200) 2. Patrick wants to buy a shirt. He will buy the shirt if the shirt's coolness rating is above a 5 out of 10 and the cost is $25 or less. if ________________________________________________________ 3. Morgan has different criteria for buying a shirt. The shirt must have at least 3 buttons and cost less than $50. if ________________________________________________________ 4. Melissa is deciding whether to date Jarid. She will go out with him if he combed his hair or if he doesn’t smell. if ________________________________________________________ 5. Jill has three criteria for deciding whether someone can be her friend. The person can be fun and kind… or they can just be rich. if ________________________________________________________
20. Answer 2 1. You set the high score in Donkey Kong if your score is over 1,050,200 points. if(score > 1050200) 2. Patrick wants to buy a shirt. He will buy the shirt if the shirt's coolness rating is above a 5 out of 10 and the cost is $25 or less. if((coolness > 5) && (cost<=25)) 3. Morgan has different criteria for buying a shirt. The shirt must have at least 3 buttons and cost less than $50. if((buttons>=3) && (cost < 50)) 4. Melissa is deciding whether to date Jarid. She will go out with him if he combed his hair or if he doesn’t smell. if(combed || smell) 5. Jill has three criteria for deciding whether someone can be her friend. The person can be fun and kind… or they can just be rich. if((fun && kind) || rich)