Concept explainers
(Telephone-Number Word Generator) Standard telephone keywords contain the digits 0 through 9. The numbers 2 through 9 each have three letters associated with them, as is indicated by the following table:
Digit Letter | Digit Letter |
2 ABC 3 DEF 4 GHI 5 JKL |
6 MNO 7 PQRS 8 TUV 9 WXYZ |
Fig. 14.18 Telephone digit-to-letter mappings.
Many people find it difficult to memorize phone numbers, so they use the correspondence between digits and letters to develop seven-letter words that correspond to their phone numbers. For example, a person whose telephone number is 686-2377 might use the correspondence indicated in the above table to develop the seven-letter word "NUMBERS."
Businesses frequently attempt to get telephone numbers that are easy for their clients to remember. If a business can advertise a simple word for its customers to dial, then no doubt the business will receive a few more calls. Each seven-letter word corresponds to exactly one seven-digit telephone number. The restaurant wishing to increase its take-home business could surely do so with the number 825-3688 (i.e., "TAKEOUT"). Each seven-digit phone number corresponds to many separate seven-letter words. Unfortunately, most of these represent unrecognizable juxtapositions of letters. It's possible, however, that the owner of a barber shop would be pleased to know that the shop's telephone number, 424-7288, corresponds to "HAIRCUT" A veterinarian with the phone number 738-2273 would be happy to know that the number corresponds "PETCARE.”
Write a program that, given a seven-digit number, writes to a file every possible seven-letter word corresponding to that number. There are 2187 (3 to the seventh power) such words. Avoid phone numbers with the digits 0 and 1.
Want to see the full answer?
Check out a sample textbook solutionChapter 14 Solutions
C++ How to Program (Early Objects Version)
- Language: JAVA Leap-Year Write a program to find if a year is a leap year or not. We generally assume that if a year number is divisible by 4 it is a leap year. But it is not the only case. A year is a leap year if − It is evenly divisible by 100 If it is divisible by 100, then it should also be divisible by 400 Except this, all other years evenly divisible by 4 are leap years. So the leap year algorithm is, given the year number Y, Check if Y is divisible by 4 but not 100, DISPLAY "leap year" Check if Y is divisible by 400, DISPLAY "leap year" Otherwise, DISPLAY "not leap year" For this program you have to take the input, that is the year number from an input file input.txt that is provided to you. The input file contains multiple input year numbers. Use a while loop to input the year numbers from the input file one at a time and check if that year is a leap year or not. Create a class named LeapYear which will contain the main method and write all your code in the main…arrow_forwardC programming language questionarrow_forwardC Language - Given a highway number, indicate whether it is a primary or auxiliary highway. If auxiliary, indicate what primary highway it serves. Also indicate if the (primary) highway runs north/south or east/west.arrow_forward
- fngdndndnn n dnnndnfnfnarrow_forwardLanguage : C Jojo remembered going to a cave with his best friend Lili before the coronavirus pandemic.There, he saw several Stalactites hanging from the /cave’s ceiling. Stalactite is a type offormation that hangs from the ceiling of caves.Jojo noticed an interesting fact about the stalactites. The stalactite formation in thiscave forms a pattern. He wonders how will the formation look like if the cave is of adifferent size. He has asked your help to visualize this formation. Format Input :A single line with an integer N denoting the size of the cave Format Output :A size N formation of stalactites. Do not print extra spaces behind the last ‘*’ character in each line. Constraints : • 1 ≤ N ≤ 12 Sample Input 1 :2 Sample Output 1*** *Sample Input 2 :3 Sample Output 2 :******* * * * *arrow_forwardAPLarrow_forward
- Programming Language:- Carrow_forwarddvvxarrow_forward1.) Formula for cell A15 that adds all data from B1 to D6. 2.) Formula for cell A16 that determines the lowest number found on A1, A2, A3, B1, B2, and B3. 3.) If you had a cell reference C5, but in your formula you want C to stay constant and 5 to change, what would be the correct structure? 4.) If you have a list of numbers in cells B2 through B20 and you wanted the average of these numbers, what would be the formula? 5.) Assume you are copying cell A1 to cell C3. If cell A1 contains the formula =$B1+$C$1, how would this formula change when copied to cell C3? PLS ANSWER ALL THIS QUESTIONS NO NEED TO EXPLAINarrow_forward
- 7: Exams.cpp) Suppose a teacher weights the four exams he gives 10%, 25%, 30%, and 35%. Write a program that reads ten sets of four grades, prints the weighted average of each set, and prints the unweighted average of each test. The number of students should be in a global constant.arrow_forwardPython Language Useful websites: : http://en.wikipedia.org/wiki/Radix http://www.purplemath.com/modules/numbbase.htm Special Rules: Use only Boolean/math expressions and conditional statements (if-statements). Do not use built-in functions for converting integers into a string representation. Here to start with: kthDigit(x: int, b: int, k: int) -> int .........arrow_forwardp.252, icon at Example 2 #1. Certain rules allow us to determine by inspection when a positive integer n is divisible by a positive integer k. For example, 5❘n if and only if n ends in the digit 5 or 0. Similarly, 2❘n if and only if n ends in one of the digits 0, 2, 4, 6, 8. There is also a rule to determine divisibility by 3: 3❘n if and only if the sum of the digits in n is divisible by 3. For example 3 | 478, 125 because the sum of the six digits in 478, 125 is 27, which is divisible by 3. Why does the rule work?arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning