Jump to content

Help please:

Aaaaaaaaa
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.

Sample output from program:

Translate TV Channel Number to Call Sign

 

Enter channel number: 1

Channel 1 is undesignated in your area

 

Enter channel number: 2

Call sign for channel 2 is WCBS

 

Enter channel number: 6

Call sign for channel 6 is WRNNDT

Link to comment
Share on other sites

Link to post
Share on other sites

 

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.
Sample output from program:
Translate TV Channel Number to Call Sign
 
Enter channel number: 1
Channel 1 is undesignated in your area
 
Enter channel number: 2
Call sign for channel 2 is WCBS
 
Enter channel number: 6
Call sign for channel 6 is WRNNDT

 

lol what ?

 
Link to comment
Share on other sites

Link to post
Share on other sites

It is a programming question! If you don't know anything about programming no need to hurt your brains with this.

Link to comment
Share on other sites

Link to post
Share on other sites

It is a programming question! If you don't know anything about programming no need to hurt your brains with this.

iknow programming but providing an answer to that is...well never mind. stop spamming the forums btw  

 
Link to comment
Share on other sites

Link to post
Share on other sites

I thought this was a helping site, and all you can think of is stop spamming. Smt 

Link to comment
Share on other sites

Link to post
Share on other sites

I thought this was a helping site, and all you can think of is stop spamming. Smt 

How is the data stored? Is it stored in a 2D array? 

 

What language btw? 

PSU Tier List | CoC

Gaming Build | FreeNAS Server

Spoiler

i5-4690k || Seidon 240m || GTX780 ACX || MSI Z97s SLI Plus || 8GB 2400mhz || 250GB 840 Evo || 1TB WD Blue || H440 (Black/Blue) || Windows 10 Pro || Dell P2414H & BenQ XL2411Z || Ducky Shine Mini || Logitech G502 Proteus Core

Spoiler

FreeNAS 9.3 - Stable || Xeon E3 1230v2 || Supermicro X9SCM-F || 32GB Crucial ECC DDR3 || 3x4TB WD Red (JBOD) || SYBA SI-PEX40064 sata controller || Corsair CX500m || NZXT Source 210.

Link to comment
Share on other sites

Link to post
Share on other sites

 

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.
Sample output from program:
Translate TV Channel Number to Call Sign
 
Enter channel number: 1
Channel 1 is undesignated in your area
 
Enter channel number: 2
Call sign for channel 2 is WCBS
 
Enter channel number: 6
Call sign for channel 6 is WRNNDT

 

I am not sure but i think its a work for registries or a database not a written program

ASUS Maximus VII Hero | i7 4790K OC 4.8GHZ | 4x8GB 2400MHz MSI GTX 1070 alphacool eiswolf gpx pro
Samsung 850 EVO 520GB + Corsair 525gb + 275gb SSD  2TB Seagate Barracuda | 8TB Seagate Archive

Cooler Master HAF-X 942 | EVGA Supernova 1000W 80+ Platinum | Custom watercooling loop (gpu+cpu)

360mm+180mm rad and 10 fans | Swiftech D5 mcp655-B

Link to comment
Share on other sites

Link to post
Share on other sites

djdwosk97

 

 

Pseudocode: Although there are several valid ways to write the program, the following is an outline of one way to design the overall logic.

 
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
Link to comment
Share on other sites

Link to post
Share on other sites

djdwosk97

 

 

Pseudocode: Although there are several valid ways to write the program, the following is an outline of one way to design the overall logic.

 
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

 

Well, I'm just going to assume they tell you what channel # corresponds to each network name... so: 

 

Create a 2D array, with the channel number in the first column and the name of the network in the second column. 

Get channel number. 

Find the channel number in the array. 

Print "Call sign for channel" +  ___ + "is" _____"

 

As for actually coding it...well, that depends on the language and how the channel numbers and network names are stored. 

PSU Tier List | CoC

Gaming Build | FreeNAS Server

Spoiler

i5-4690k || Seidon 240m || GTX780 ACX || MSI Z97s SLI Plus || 8GB 2400mhz || 250GB 840 Evo || 1TB WD Blue || H440 (Black/Blue) || Windows 10 Pro || Dell P2414H & BenQ XL2411Z || Ducky Shine Mini || Logitech G502 Proteus Core

Spoiler

FreeNAS 9.3 - Stable || Xeon E3 1230v2 || Supermicro X9SCM-F || 32GB Crucial ECC DDR3 || 3x4TB WD Red (JBOD) || SYBA SI-PEX40064 sata controller || Corsair CX500m || NZXT Source 210.

Link to comment
Share on other sites

Link to post
Share on other sites

djdwosk97

The language used is C# comments. And the channel numbers are set up like this

Enter channel number: 1

Channel 1 is undesignated in your area
 
Enter channel number: 2
Call sign for channel 2 is WCBS
 
Enter channel number: 6
Call sign for channel 6 is WRNNDT
Every other channel has nothing its blank. 
Link to comment
Share on other sites

Link to post
Share on other sites

 

djdwosk97

The language used is C# comments. And the channel numbers are set up like this

Enter channel number: 1

Channel 1 is undesignated in your area
 
Enter channel number: 2
Call sign for channel 2 is WCBS
 
Enter channel number: 6
Call sign for channel 6 is WRNNDT
Every other channel has nothing its blank. 

 

Well, I don't know C#, but how is the data actually stored--not whats the output supposed to be...Is it stored like that, or is it stored in an array...I cant imagine the data would be stored like that as thats a pain to work with. 

PSU Tier List | CoC

Gaming Build | FreeNAS Server

Spoiler

i5-4690k || Seidon 240m || GTX780 ACX || MSI Z97s SLI Plus || 8GB 2400mhz || 250GB 840 Evo || 1TB WD Blue || H440 (Black/Blue) || Windows 10 Pro || Dell P2414H & BenQ XL2411Z || Ducky Shine Mini || Logitech G502 Proteus Core

Spoiler

FreeNAS 9.3 - Stable || Xeon E3 1230v2 || Supermicro X9SCM-F || 32GB Crucial ECC DDR3 || 3x4TB WD Red (JBOD) || SYBA SI-PEX40064 sata controller || Corsair CX500m || NZXT Source 210.

Link to comment
Share on other sites

Link to post
Share on other sites

Well, I don't know C#, but how is the data actually stored--not whats the output supposed to be...Is it stored like that, or is it stored in an array...I cant imagine the data would be stored like that as thats a pain to work with. 

 Yes! It is stored in array.

Link to comment
Share on other sites

Link to post
Share on other sites

 Yes! It is stored in array.

Okay, so if I was going to put the data into an array I would put channel 0 in array[0][0] and the name of channel zero in array[0][1], channel one in array[1][0] and the name in array[1][1] and so on....

 

In Java it would look something like this: 

System.out.println("Enter channel number: ");int channelNumber = TextIO.getlnInt(); //gets user input System.out.println("Call sign for channel " + channelNumber + " is " + array[channelNumber]);

Now, I'm assuming that if the channel doesn't exist then the contents of the array for that channel will be the channel number in the first column and "undesignated in your area" in the second column. 

PSU Tier List | CoC

Gaming Build | FreeNAS Server

Spoiler

i5-4690k || Seidon 240m || GTX780 ACX || MSI Z97s SLI Plus || 8GB 2400mhz || 250GB 840 Evo || 1TB WD Blue || H440 (Black/Blue) || Windows 10 Pro || Dell P2414H & BenQ XL2411Z || Ducky Shine Mini || Logitech G502 Proteus Core

Spoiler

FreeNAS 9.3 - Stable || Xeon E3 1230v2 || Supermicro X9SCM-F || 32GB Crucial ECC DDR3 || 3x4TB WD Red (JBOD) || SYBA SI-PEX40064 sata controller || Corsair CX500m || NZXT Source 210.

Link to comment
Share on other sites

Link to post
Share on other sites

Okay, so if I was going to put the data into an array I would put channel 0 in array[0][0] and the name of channel zero in array[0][1], channel one in array[1][0] and the name in array[1][1] and so on....

 

In Java it would look something like this: 

System.out.println("Enter channel number: ");int channelNumber = TextIO.getlnInt(); //gets user input System.out.println("Call sign for channel " + channelNumber + " is " + array[channelNumber]);

Now, I'm assuming that if the channel doesn't exist then the contents of the array for that channel will be the channel number in the first column and "undesignated in your area" in the second column. 

Okay! What about what comes ahead of that? Declaring the variables?

Link to comment
Share on other sites

Link to post
Share on other sites

Okay! What about what comes ahead of that? Declaring the variables?

Well, im assuming the array has already been created. And you dont need to create any other variables (at least you dont in java or c++)

PSU Tier List | CoC

Gaming Build | FreeNAS Server

Spoiler

i5-4690k || Seidon 240m || GTX780 ACX || MSI Z97s SLI Plus || 8GB 2400mhz || 250GB 840 Evo || 1TB WD Blue || H440 (Black/Blue) || Windows 10 Pro || Dell P2414H & BenQ XL2411Z || Ducky Shine Mini || Logitech G502 Proteus Core

Spoiler

FreeNAS 9.3 - Stable || Xeon E3 1230v2 || Supermicro X9SCM-F || 32GB Crucial ECC DDR3 || 3x4TB WD Red (JBOD) || SYBA SI-PEX40064 sata controller || Corsair CX500m || NZXT Source 210.

Link to comment
Share on other sites

Link to post
Share on other sites

Well, im assuming the array has already been created. And you dont need to create any other variables (at least you dont in java or c++)

No! :/

Link to comment
Share on other sites

Link to post
Share on other sites

No! :/

well, how are you given the information then? The channel number and its associated name has to be in the program somehow. And since it would be stupid if the user had to enter that information, it has to be there before you compile it...so, how does it get there? Are you told what channel is related to what and you have to create the array with that information in it, or is it given to you.

PSU Tier List | CoC

Gaming Build | FreeNAS Server

Spoiler

i5-4690k || Seidon 240m || GTX780 ACX || MSI Z97s SLI Plus || 8GB 2400mhz || 250GB 840 Evo || 1TB WD Blue || H440 (Black/Blue) || Windows 10 Pro || Dell P2414H & BenQ XL2411Z || Ducky Shine Mini || Logitech G502 Proteus Core

Spoiler

FreeNAS 9.3 - Stable || Xeon E3 1230v2 || Supermicro X9SCM-F || 32GB Crucial ECC DDR3 || 3x4TB WD Red (JBOD) || SYBA SI-PEX40064 sata controller || Corsair CX500m || NZXT Source 210.

Link to comment
Share on other sites

Link to post
Share on other sites

well, how are you given the information then? The channel number and its associated name has to be in the program somehow. And since it would be stupid if the user had to enter that information, it has to be there before you compile it...so, how does it get there? Are you told what channel is related to what and you have to create the array with that information in it, or is it given to you.

 Yes we have to enter that information in Visual Studio. We have to enter in the information, write our own code with the hopes of achieving the output. This is the question given to me below, this is all the information I was given.

Requirements
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.
Sample output from program:
Translate TV Channel Number to Call Sign
 
Enter channel number: 1
Channel 1 is undesignated in your area
 
Enter channel number: 2
Call sign for channel 2 is WCBS
 
Enter channel number: 6
Call sign for channel 6 is WRNNDT
 
Tips
Best practice: Put yourself in the place of the program. What steps would you personally need to perform in order to process a channel translation yourself? Write out those steps on paper as pseudocode and/or in Visual Studio as C# comments, and then implement them one by one, testing as you go. Remember to not write too much at one time. Always add and test functionality incrementally!
Pseudocode: Although there are several valid ways to write the program, the following is an outline of one way to design the overall logic.
 
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
Link to comment
Share on other sites

Link to post
Share on other sites

Do you have to get the users area?

You could use a 2D array (or map)... Area on the Y axis, and Channel on the X axis. Then simply use the area and channel number to index the array/map and return the corresponding callsign.

Easy.

Link to comment
Share on other sites

Link to post
Share on other sites

This is an very ugly solution, but I only had a few mins to chuck this together.

 

You could also use a switch statement and have a default case that says "I don't know this channel".

 

You might also want to add a looping function that allows the user to re-enter a number and get another channel name.

 

More information would be nice next time so we know how in depth your programming knowledge is.

 

Hope this helped.

static void Main(string[] args)        {            string[] channelNames = new string[10];            channelNames[0] = "AAAAAA";            channelNames[1] = "BBBBBB";            channelNames[2] = "CCCCCC";            channelNames[3] = "DDDDDD";            channelNames[4] = "EEEEEE";            channelNames[5] = "FFFFFF";            channelNames[6] = "GGGGGG";            channelNames[7] = "HHHHHH";            channelNames[8] = "IIIIII";            channelNames[9] = "JJJJJJ";            int channelNumber = 0;            string line;            Console.Write("Please enter a channel number: ");            line = Console.ReadLine();            if ((int.TryParse(line, out channelNumber)) && (channelNumber > 0 && channelNumber < 10))            {                Console.WriteLine("Channel Name is " + channelNames[channelNumber - 1]);            }            else            {                //The number that was has been entered was wrong.                Console.WriteLine("ERROR: There was an error with the channel name");            }            Console.ReadLine(); //Only here to make sure that the program does not close when you are trying to read the console.        }
Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×