Write a program that simulates the dialing of a phone number

Assignment Help Programming Languages
Reference no: EM131320989

In this lab you will write a program that simulates the dialing of a phone number. The phone number may have either digits, letters, or both. (See sample output below) Here are the letters associated with each digit.

0 5 J K L

1 6 M N O

2 A B C 7 P Q R S

3 D E F 8 T U V

4 G H I 9 W X Y Z

If the phone number entered does not have one of the valid digits or valid letters, display an error message. Write a method to convert the letter to a digit and to determine if it is valid.

A phone number never begins with a 0, so the program should flag an error if such a number is entered. Also a phone number never begins with 555, so the program should flag an error if such a number is entered. A phone number always has a hyphen (-) in the 4th position. Display an error message if it is not. If a hyphen is in any other position, it is considered an invalid digit and display an error message.

Use the switch statement wherever possible. Use Console.Read to input one character at a time from the keyboard buffer. Your output needs to look like mine.

Sample Output from Program - Each 3 lines is one run of the program.

Enter a phone number: s&i-oiem

Digit 2 is invalid

Press any key to continue . . .

Enter a phone number: asn-fgtr

Phone Number Dialed: 276-3487

Press any key to continue . . .

Enter a phone number: 0io-9876

Phone number cannot begin with a 0

Press any key to continue . . .

Enter a phone number: jkl-oiuy

Phone number cannot begin with 555

Press any key to continue . . .

Enter a phone number: asdfghjk

Digit 4 must be a hyphen

Press any key to continue . . .

Reference no: EM131320989

Questions Cloud

Interpret this partial correlation : The resulting partial correlation was .35. Interpret this partial correlation.
Explain in your own words the power of if function in excel : Explain in your own words the power of the IF function in Excel, and indicate at least one way in which a person could utilize this function in work or personal life. Provide a rationale for your response.
Determine the required concentration of the donor : Determine the required concentration of the donor and the acceptor Impurities, assuming that all the impurities are ionized, I e., each donor gives one electron and each acceptor gives one hole.
Identify appropriate marketing tools : Create a marketing strategy based on this position in the life-cycle: Identify appropriate marketing tools. Assess challenges and opportunities as they relate to its niche, competition, and position in life cycle
Write a program that simulates the dialing of a phone number : In this lab you will write a program that simulates the dialing of a phone number. The phone number may have either digits, letters, or both. (See sample output below) Here are the letters associated with each digit.
Targeting and growing the female market segment : Should under amour continue targeting and growing the female market segment? Or should it target a broader population to gain more traction on Nike and get closer to the number one spot?Should Under Armour keep paying famous athletes to be part of..
When do researchers use regression analysis : Distinguish among simultaneous (or standard), stepwise, and hierarchical regression.
Develop an action plan for creating your personal brand : Describe what you want your personal brand to be. In the next step, you develop an action plan for creating or enhancing your personal brand. Provide at least one clear example of an experience in this course that has helped, or may help, you move to..
What line is described by a regression equation : Write the general form of a regression equation that has a single predictor variable. Identify the criterion variable, the predictor variable, the regression constant, and the regression coefficient.

Reviews

Write a Review

Programming Languages Questions & Answers

  Calculate the minimum salary for all employees.

Write SQL SELECT, UPDATE, and DELETE statements.

  Write a marie program using a loop

Write a MARIE program using a loop that multiplies two non-negative numbers by using repeated addition. For example, to multiply 3 x 6, the program would add 3 six times (e.g. 3 + 3 + 3 + 3 + 3 + 3) or add 6 three times (e.g. 6+6+6). You should wr..

  Application should calculate and display the order amounts

Make sure the number of units for each package is numeric, and is not negative.

  Program to store item-s price

Suppose a c++ program requires to store item's price. Price will range from $15.50 to $20. Write down assignment statement which allots value $16.23 to variable.

  Write a procedure to find no of words in a given string

Write a procedure to find no of words in a given string assume that two words are seperated by more than one space Eg.

  Logic for a program that performs arithmetic functions

Create the logic for a program that performs arithmetic functions. Design the program to contain two numeric variables. Prompt the user for values for the variables

  Write program which instantiates objects of classes

Private data of Quadrilateral must be the x-y coordinate pairs for four end-points of the Quadrilateral. Write a program which instantiates objects of your classes and outputs each objects area (except Quadrilateral.

  Design a real time flood monitoring system

Assignment 3: Design a Real Time Flood Monitoring System based on Arduino Microcontroller. The system should monitor flood related information like Water level and Precipitation. The data collected from the sensors should be transferred to a client a..

  Questions on programing problem with the process of analysis

Questions on Programing Problem with the process of analysis and reflection that went on as you developed the project.

  Weka answer in the file i upload and do the best this

answer in the file i upload and do the best. this assignment would need use weka on last question. please follow

  Pogram to recognize the particular memory location

The 12-bit address recognizes the particular Memory location or I/O device. Illustrate the program execution for following programs.

  Write a recursive-descent parser

Use any programming language you prefer to write a recursive-descent parser that parses the language generated by the following EBNF descriptions

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd