-
November 17th, 2012, 01:30 AM
#1
Is anybody capable of providing me with guidance, not opinions?
So the question is:
People sometimes give their telephone number using one or more alphabetic characters. Write a program that accepts a 10-digit telephone number that may contain one or more alphabetic characters. Display the corresponding number using numerals. The numbers and letters are associated as follows on your telephone:
ABC:2
DEF:3
GHI:4
JKL:5
MNO:6
PQRS:7
TUV:8
WXYZ:9
If the user enters a character that is not on the telephone as part of the number, display a message indicating that the value does not match a number. Allow both upper- and lowercase characters to be entered.
This must also be created for use in a Windows Form Application, by the way..
Now, I've been attempting to complete this assignment for the past week. I have tried if statements, for/foreach loops, etc. and I still am unable to finish it properly.
Here is what I currently have:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void bConvert_Click(object sender, EventArgs e)
{
ConsoleKeyInfo keyInfo = Console.ReadKey();
char selectedChar = keyInfo.KeyChar;
switch (selectedChar)
{
case '2':
case 'A':
case 'a':
case 'B':
case 'b':
case 'C':
case 'c':
break;
}
}
}
}
Any tips/examples to show how to complete code? Easier ways to go about completing the task appropriately?
Thanks people.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|