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

  Program to tests whether a word or phrase is a palindrome

The choice of page elements (e.g., test boxes, buttons, text areas) and their layout is up to you, but the overall design should be intuitive and user friendly.

  Write statement to determine whether array elements are full

Write the statements needed to determine whether any of the the array elements are null or refer to the empty String. Set the variable hasEmpty to true if any elements are null or empty-- otherwise set it to false.

  Determine the output displayed in the list box

Determine the output displayed in the list box by the lines of code

  1 microsoft is developing a new program and they want to

1. microsoft is developing a new program and they want to identify the break-even point.their fixed cost is 72000 while

  Identify the various uses for http and https

Identify the various uses for HTTP and HTTPS

  Implement a program that prompts the user for an integer

Implement a program that prompts the user for an integer n and prints the nth Fibonacci number, using the above algorithm.

  Compare and contrast three scripting languages

For this project, students will compare and contrast three scripting languages, the approaches, and techniques used in each to facilitate interactive design

  Write function is pseudocode to calculate area of triangle

Write down the function is pseudocode called calculate area which calculates the area of a triangle. Algorithm for area computation is this: area=1/2*base*height.

  Design a small dictionary using the binary search tree

Design a small dictionary using the Binary Search Tree data structure. Each entry may include a word and its definitions. You should create the tree structure/dictionary using data input from a text file. After the dictionary is created, the user ..

  C compiler will not compile the line of code in the center

In the following lines of code, the Miracle C compiler will not compile the line of code in the center (float x = 1/a;). Why does this occur? How can it be corrected?

  Provide an analytical result for data science requirements

Provide an analytical result for data science requirements - The purpose of the project is to analyse jobs advertised for data science position within ACT region for the purpose of avoiding users going through all jobs advertised in order to know t..

  Write a program that will calculate the monthly payment

Using the information in the table below, write a program that will calculate the monthly payment based on user inputs of loan amount and number of monthly payments.

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