[phpBB Debug] PHP Warning: in file [ROOT]/ext/lmdi/autolinks/event/listener.php on line 237: Undefined array key 68
[phpBB Debug] PHP Warning: in file [ROOT]/ext/lmdi/autolinks/event/listener.php on line 237: Trying to access array offset on value of type null
Answer Happy • Switch Statement • Syntax: switch(x) where x must be a variable of integer (int) or character (char) type. Switch statem
Page 1 of 1

Switch Statement • Syntax: switch(x) where x must be a variable of integer (int) or character (char) type. Switch statem

Posted: Thu Jun 02, 2022 8:30 am
by answerhappygod
Switch Statement Syntax Switch X Where X Must Be A Variable Of Integer Int Or Character Char Type Switch Statem 1
Switch Statement Syntax Switch X Where X Must Be A Variable Of Integer Int Or Character Char Type Switch Statem 1 (8.8 KiB) Viewed 29 times
Switch Statement Syntax Switch X Where X Must Be A Variable Of Integer Int Or Character Char Type Switch Statem 2
Switch Statement Syntax Switch X Where X Must Be A Variable Of Integer Int Or Character Char Type Switch Statem 2 (24.96 KiB) Viewed 29 times
Switch Statement Syntax Switch X Where X Must Be A Variable Of Integer Int Or Character Char Type Switch Statem 3
Switch Statement Syntax Switch X Where X Must Be A Variable Of Integer Int Or Character Char Type Switch Statem 3 (25.34 KiB) Viewed 29 times
Switch Statement Syntax Switch X Where X Must Be A Variable Of Integer Int Or Character Char Type Switch Statem 4
Switch Statement Syntax Switch X Where X Must Be A Variable Of Integer Int Or Character Char Type Switch Statem 4 (21.17 KiB) Viewed 29 times
Switch Statement Syntax Switch X Where X Must Be A Variable Of Integer Int Or Character Char Type Switch Statem 5
Switch Statement Syntax Switch X Where X Must Be A Variable Of Integer Int Or Character Char Type Switch Statem 5 (28.87 KiB) Viewed 29 times
Switch Statement Syntax Switch X Where X Must Be A Variable Of Integer Int Or Character Char Type Switch Statem 6
Switch Statement Syntax Switch X Where X Must Be A Variable Of Integer Int Or Character Char Type Switch Statem 6 (24.17 KiB) Viewed 29 times
Switch Statement • Syntax: switch(x) where x must be a variable of integer (int) or character (char) type. Switch statement can sometimes replace "if-else" on some problems.
Exercise: 1. Write a program using switch statement that, given a number representing a TV channel, uses a switch statement to display the call letters of the station that corresponds to that number (or displays a message indicating that the channel is not used). Use the following channel numbers and call letters: (TITLE: channel) Channel Station Name 2 WCBS 4 WNBC 5 WNEW 7 WABC 9 WOR
2. Write a program using switch statement that takes a letter grade as an input. The program will output a comment based on the letter grade as shown below. Make sure that your program will read the letter grade input whether it is upper or lower case. The program must also warn the user to enter the proper letter grade if he/she enters a letter grade not shown in the table. Equivalent Comments Letter A Excellent Very Good Passing Needs Improvement ABCF
3. Write a program using switch statement that takes a quiz score between 0 to 100 (it is assumed that the user will only enter score within the range). The program will output a comment based on the quiz score as follows. Average Comment High Achiever [80, 100] [60,80) Achiever [50,60) Satisfactory Below 50 Must see the advisor
4. Write a program using switch statement that takes the number of line segments of a figure as an input. It will output the name of the figure. The program must output a warning message if the user enters a number of sides not shown in the table below. Number of sides Name of Figure 1 Line 3 Triangle 4 Quadrilateral 5 Pentagon 6 Hexagon 7 Heptagon 8 Octagon 9 Nonagon 10 Decagon 11 Undecagon 12 Dodecagon
5. Write a program using switch statement that takes 3 quiz scores (it is assumed that the user will enter scores within the range 0-100). It will calculate the quiz average then converts the average to letter grade. Average Equivalent Letter [90, 100] A+ [80, 90) A [70, 80) B+ [60, 70) B [50, 60) C+ Below 50 F