it is in C# programing language. Your mission: Write a program that translates a
ID: 3760970 • Letter: I
Question
it is in C# programing language.
Your mission: Write a program that translates a TV channel (1 through 10) in your area to its respective call sign. For example, in the New York metropolitan area, channel 2 translates to WCBS. If a channel is unused in your area, tell the user that this is the case.
Psuedocode
Declare variables for channel and call sign
Get channel number from user
Use appropriate decision structure to translate number to call sign
If number is valid in area
Print out translation
If not
Tell user this is the case
Explanation / Answer
As you didn't specified your language requirement, I wrote it in C. If you need any further modification, let me know.
#include <stdio.h>
int main()
{
int channel;
printf("Enter the channel number: ");
scanf("%i", &channel);
switch(channel)
{
case 1: printf("%i: KAKE ", channel); break;
case 2: printf("%i: KARE ", channel); break;
case 3: printf("%i: KAMU ", channel); break;
case 4: printf("%i: KAKW ", channel); break;
case 5: printf("%i: KAPP ", channel); break;
case 6: printf("%i: KAVU ", channel); break;
case 7: printf("%i: KADN ", channel); break;
case 8: printf("%i: KAAS ", channel); break;
case 9: printf("%i: KAZQ ", channel); break;
case 10:printf("%i: KAMR ", channel); break;
default:printf("Its not a valid number. "); break;
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.