# Lecture25 - ComputerProgrammingITAC162. Todays Agenda More...

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

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

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

View Full Document
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”
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

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

View Full Document
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
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

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

View Full Document
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
Computer Programming I TA C162 . 06 MAR 2006

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

View Full Document
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
Ask a homework question - tutors are online