Code in c++
Introduction The purpose of this assignment is to familiarize you with the writing a C++ program that demonstrates the usage of string processing by translating alphabetic characters to a numeric character as on a telephone. Alphabetic Telephone Number Translator Many companies use telephone numbers like 555-GET-FOOD so the number is easier for their customers to remember. On a standard telephone, the alphabetic letters are mapped to numbers in the following fashion: A, B, and C = 2 M, N, and O = 6 D, E, and F = 3 P, Q, R, and S = 7 G, H, and I = 4 T, U, and V = 8 J, K and L = 5 W, X, Y and Z = 9 Write a program that asks the user to enter a 10-character telephone number in the format XXX-XXX-XXXX. The application should display the telephone number with any alphabetic characters that appeared in the original translated to their numeric equivalent. For example, if the user enters 555-GET-FOOD, the application should display 555-438-3663. Program Input The program will loop continuously and prompt the user: "Enter the telephone number in the format XXX-XXX-XXXX (x or X to exit): " The 12-character input string should be in the xxx-xxx-xxxx format. If the user enters x or X, instead of the 12-character input, the program will terminate. Note: The program should have an input loop which validates the telephone number: • The length should be exactly 12 characters The dashes are in the correct locations within the string The program should transform alphabetic characters to upper-case
Assignment 4S-LO: 5, LO: 10, LO: 12 Before submitting, Refer to C++ Programming Coding Standards document. Program Calculation The program will translate any letters received to their appropriate numeric digits. Program Output Welcome to the Alphabetic Telephone Number Translator This program will translate phone numbers with alphabetic to its numeric equivalent. The phone number [555-GET-FOOD] is 555-438-3663 The phone number [GET-INN-HELP] is 438-466-4357 Program Notes For this assignment, you will be required to create a function to collect the user data such as getInput(). The function should validate the data from the user. Additionally, you may consider another function to translate the string to all uppercase. Submit Instructions • Refer to the C++ Programming Coding Standards document located on the Course Overview Page on Canvas. • Submit file via Canvas's submission tool.
Code in c++
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am