Download presentation
Presentation is loading. Please wait.
2
1 Session-15 CSIT 121 Spring 2006 Selection with Switch~Case Selection with Switch~Case Need an integer or character to test for Need an integer or character to test for Example: Counting vowels entered by the user Example: Counting vowels entered by the user Example: Deciding what the user wants to do Example: Deciding what the user wants to do
3
2 Demo Due Thu March 16 Develop a program that asks the user to enter the age of a child Develop a program that asks the user to enter the age of a child If the child is 5 years old, display “the child is admitted to Kindergarten” If the child is 5 years old, display “the child is admitted to Kindergarten” If the child is 6 years old, display “the child can enter Grade I” If the child is 6 years old, display “the child can enter Grade I” If the child is 7 years old, display “the child can enter Grade 2” If the child is 7 years old, display “the child can enter Grade 2” On the age of 8, 9 and 10 years, change the display to admit for Grade 3,4 and 5 On the age of 8, 9 and 10 years, change the display to admit for Grade 3,4 and 5 On any other age, display “error in age input, exiting….” On any other age, display “error in age input, exiting….” The program must use switch~case selection otherwise no points will be awarded The program must use switch~case selection otherwise no points will be awarded
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.