C++ Beginner - Program Help
IntroductionThe purpose of this assignment is to familiarize youwith writing a C++ program thatdemonstrates the usage of string processing by translatingalphabetic characters to a numericcharacter as on a telephone.Alphabetic Telephone Number TranslatorMany companies use telephone numbers like 555-GET-FOOD so thenumber is easier fortheir customers to remember. On a standard telephone, thealphabetic letters are mapped tonumbers in the following fashion:A, B, and C = 2 D, E, and F = 3 G, H, and I = 4 J, K and L =5M, N, and O = 6 P, Q, R, and S = 7 T, U, and V = 8 W, X, Y and Z =9Write a program that asks the user to enter a 10-charactertelephone number in the formatXXX-XXX-XXXX. The application should display the telephone numberwith anyalphabetic characters that appeared in the original translated totheir numeric equivalent. Forexample, if the user enters 555-GET-FOOD, the application shoulddisplay 555-438-3663.Program InputThe program will loop continuously and prompt the user:- “'Enter the telephone number in the format XXX-XXX-XXXX (x or Xto 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 willterminate.Note:The program should have an input loop that validates the telephonenumber:• The length should be exactly 12 characters• The dashes are in the correct locations within the string• The program should transform alphabetic characters intoupper-caseProgram CalculationThe program will translate any letters received to theirappropriate numeric digits.Program Output
-----------------------------------------------------------------------Welcome to the Alphabetic Telephone Number TranslatorThis program will translate phone numbers with alphabeticto its numeric equivalent.The phone number [555-GET-FOOD] is 555-438-3663The phone number [GET-INN-HELP] is 438-466-4357
NotesFor this assignment, you will be required to create a function tocollect the user data such asgetInput(). The function should validate the data from theuser.Additionally, you may consider another function to translate thestring to all uppercase.
C++ Beginner - Program Help Introduction The purpose of this assignment is to familiarize you with writing a C++ program
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am