Lecture25 - ComputerProgrammingITAC162. Todays Agenda More...

Info iconThis preview shows pages 1–8. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Computer Programming I TA C162 . 06 MAR 2006 Today’s Agenda More programming examples on Conditional Control Structure If statement Switch statement Conditional operator statement
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Computer Programming I TA C162 . 06 MAR 2006 1. Problem Definition Write a program that returns a letter grade based on a quiz score. The input will be the integer score from a 10 point quiz. The letter grades are assigned by: 9 - 10 “A” 7 - 8 “B” 5 - 6 “C” 3 - 4 “D” < 3 “F” 2. Refine, Generalize, Decompose the problem definition (i.e., identify subproblems, I/O, etc.) Input = integer score Output=character “grade”
Background image of page 2
3 Computer Programming I TA C162 . 06 MAR 2006 3. Develop Algorithm (processing steps to solve problem) 1. Read input value in score 2. Compare score with 9 and 10 if true print “A” else Compare score with 8 and 7 if true print “B” else Compare score with 5 and 6 if true print “C” else Compare score with 3 and 4 if true print “D” else print “F” 3. End
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Computer Programming I TA C162 . 06 MAR 2006 Flowchart Print “enter score” Read score score == 10 || score == 9 Print “A” True False (continued on next slide) (skip else part of statement) Stop
Background image of page 4
5 Computer Programming I TA C162 . 06 MAR 2006 False score == 8 || score == 7 Print “B” ; True (skip else part of statement) (continued on next slide) False
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 Computer Programming I TA C162 . 06 MAR 2006 False score == 6 || score == 5 Print “C” ; True (skip else part of statement) (continued on next slide) False
Background image of page 6
Computer Programming I TA C162 . 06 MAR 2006
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/14/2010 for the course CS SS ZG653 taught by Professor Shanta during the Spring '09 term at Birla Institute of Technology & Science.

Page1 / 22

Lecture25 - ComputerProgrammingITAC162. Todays Agenda More...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online