In: Computer Science
JAVA PROGRAMMING
project 1:
Businesses want phone numbers that are easy to remember, and one that can be tied to a phone number are even better.
Given the “standard international keypad”, write anaysis and design to determine the phone number based on a user-supplied 7-letter phrase.
1 |
2 ABC |
3 DEF |
4 GHI |
5 JKL |
6 MNO |
7 PQRS |
8 TUV |
9 WXYZ |
* |
0 |
# |
Test cases:
● BadDogs
● GoodCat
● Glasses
● EatGood
------------------------------------------------------------------------------------------------------------------------
I ONLY NEED ANALYSIS AND DESIGN! NOT CODE!
create an Analysis: (Describe the problem including input and output in your own words.)
--> description of the problem situation is provided all required rules/guidelines are listed. A listing of all necessary inputs/outputs is included
create a Design: (Describe the major steps for solving the problem.)
--> A plan for implementation of a solution is provided. The plan effectively demonstrates the use of loops and conditional branching statements where appropriate to the solution. The plan effectively demonstrates modular program design. The plan is completed using appropriate flowcharting and/or pseudocode techniques The plan includes a listing of all necessary variable declarations (including type), then uses the variables consistently to complete the solution
Analysis:
Here Every time we need to get the input from the user and then need to apply the logic to convert the given input to output.. Every Input must be processed and each alphabet must be converted to the respected to digit based on the mobile keypad format.. Eg : if either A,B or C is given then it will return 2
Design:
Consider a variable to store the user input then take the first element from the input. Now based on the element program will return the digit. This can be achieved by considering two arrays one for characters and other for digit. For a character at index 'x' from character array will be converted to a digit at the index 'x' in digits array. In this manner, every element from the user input will be processed and output will be returned.
Combining of digits returned will be done by multiplying the first occured digit with 10 and later if second digit obtained the multiply first digit with 100 and second digit with 10 and this process continues....