Living is easy with eyes closed (original) (raw)

Need help.

I don't get how to convert those letters unless during the input part, I gotta have each thing input separately and I am unsure on how to do that.

"Write a program that simulates the dial of a phone number. The program will input a phone number and the program will acknowledge the call by either writing an error message or the 8-digit phone number to the console window. The phone number may have digits, letters, or both.

Define a method named ReadDials( ) that reads each digit/letter dialed into eight separate char variables (DO NOT USE ARRAYS). All digits are sent back through parameters by reference. Then, for each digit, the program will use a method named ToDigit( ), which receives a single char argument (pass by reference) that may be a number or a letter of one of the digits dialed. If it is a number, return 0 by value indicating it is a valid digit. If the digit is a letter, the number corresponding to the letter is returned by reference and return 0 by value indicating it is a valid digit. Here are the letters associated with each digit.

If the digit entered is not one of the valid digits or valid letters, return –1 by value indicating that you have an invalid digit.
A phone number never begins with a 0, so the program should flag an error if such a number is entered. Make ReadDials( ) return –2 in this case. Also, a phone number never begins with 555, so the program should flag an error if such a number is entered. Make ReadDials( ) return –3 in this case. A phone number always has a hyphen (-) in the fourth position. Make ReadDials( ) return –4 if it doesn't have a hyphen in the fourth position. If a hyphen is in any other position, it is considered an invalid digit. If the phone number is valid, main calls the AcknowledgeCall( ) method to write the converted number to the output file.

All the logic of the program should be put in methods that are called from Main(): ReadDials( ), and AcknowledgeCall( ). The ToDigits() method is called from the ReadDials( ) method and is used to convert each letter entered individually to a digit and to verify the user has entered a valid phone number. Have the program work for any number of phone numbers. Continue processing until the user enters a Q.

In the ToDigits() method use the Char.ToUpper method to convert any letters entered to uppercase. All error messages are to be written to the output file from Main( ) based on the return value from the methods.

You will set up the eight char variables to hold the digits of the phone number in Main ( ) and pass the variables to the methods by reference. "