Concept explainers
(Telephone-Number Word Generator) Standard telephone keypads contain the digits 0–9. The numbers 2–9 each have three letters associated with them, as is indicated by the following table:
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 UNUMBERS.”
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.” The owner of a liquor store would, no doubt, be delighted to find that the store’s telephone number, 233-7226, corresponds to “BEERCAN.” A veterinarian with the phone number 738-2273 would be pleased to know that the number corresponds to the letters “PETCARE.”
Write a C 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 11 Solutions
MYPROGRAMMINGLAB WITH PEARSON ETEXT
- Python Jupyter Notebookarrow_forward*Please help in javascript* Summary: Given integer values for red, green, and blue, subtract the gray from each value. Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255. Thus (255, 0, 0) is bright red, (130, 0, 130) is a medium purple, (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (In other words, equal amounts of red, green, blue yield gray). Given values for red, green, and blue, remove the gray part. Ex: If the input is: 130 50 130 the output is: 80 0 80 import java.util.Scanner; public class LabProgram {public static void main(String[] args) {/* Type your code here. */}}arrow_forwardBroken Cabins Problem Statement: There is an Office consisting of m cabins enumerated from 1 to m. Each cabin is 1 meter long. Sadly, some cabins are broken and need to be repaired. You have an infinitely long repair tape. You want to cut some pieces from the tape and use them to cover all of the broken cabins. To be precise, a piece of tape of integer length t placed at some positions will cover segments 5,5+1-sit-1. You are allowed to cover non-broken cabins, it is also possible that some pieces of tape will overlap. Time is money, so you want to cut at most k continuous pieces of tape to cover all the broken cabins. What is the minimum total length of these pieces? Input Format The first line contains three integers n,m and k(1sns10°, namsloº, Isksn) - the number of broken cabins, the length of the stick and the maximum number of pieces you can use The second line contains n integers bl,b2,bn (Isbism) - the positions of the broken cabins. These integers are given in increasing…arrow_forward
- C language programarrow_forward#Basic Python, please help# Roses on a tree can be either red or white, represented with an appropriate data type that you will need to design. In panic mode, you must write a Python program that paints red all the roses on a rose tree. Test your program on 3 trees, each holding at least 7 roses.arrow_forwardObject-Oriented Programming ------------------------------------arrow_forward
- Python Language: Word Sleuth Programarrow_forwardWhat a solution with java language please ?arrow_forwardCode in C++ Language STRING FLIP ALPHABET One of the simplest cryptography technique is to invert the characters such that the first character of the alphabet will be replaced to the last character, the second character be replaced to the second to the last, and so on. So all A's are turned into Z's, B to Y, C to X, and so on until X to C, Y to B, and Z to A. In a similar fashion, numeric characters will also be inverted such that 0 will become 9, 1 to 8, 2 to 7 and so on until 7 to 2, 8 to 1, and 9 to 0. Given a string composed of uppercase and lowercase letters, numbers, and spaces, your task is to invert them. You also must keep the case of the letters as is. Input: A string composed of uppercase and lowercase letters, numbers, and spaces. The quick brown 1 Fox jumps over the 6 lazy Dogs Output: The inverted string Gsv jfrxp yildm 8 Ulc qfnkh levi gsv 3 ozab Wltharrow_forward
- Python Answer Required: A Rajesh teaches a cooking class. The course is attended by NN students, numbered 11 to NN. The cook must participate in the presence before each class, i.e. call out the names of the students one by one and indicate which students are present. Each student has a first and last name. To save time, Rajesh only wants to call up students' first names. However, if there are multiple students with the same first name, the Rajesh must call out the full names (first and last names) of all those students. For any student who does not share a first name with any other student, the cook can still only call that student's first name. Help the Rajesh decide for each student whether to call that student's full name or just their first name. Input 1 1 hasan jaddouh Output hasanarrow_forwardC Language Title: Quests from the Queenarrow_forwardWrite a method that computes the binary fraction representation of a positive integer. To find the binary representation, divide the integer by 2 successively and write the remainders left to right until the quotient becomes 0. (C# CONSOLE PROGRAMMİNG)arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning