223k views
3 votes
The most important part of developing a program/software is the design process. You are required to describe the following characteristics: purpose, input, process, and output, and create three test cases, pseudocode and a flowchart for each of the following questions. You may use any tool you desire to create your flowchart, but it cannot be hand drawn.

Question 3: Soundex System

Soundex is a system that encodes a word into a letter followed by three digits that roughly describe how the word sounds. That is, similar sounding words have similar four-character codes. For instance, the words carrot and caret are both coded as C630. A slight variation of the Soundex coding algorithm is as follows:

Retain the first letter.

For the remaining letters, delete all occurrences of a, e, i , o, u, h, y, and w

Replace the letters that remain with numbers so that

b, f, p, and v become 1

c, g, j, k, q, s, x, and z become 2

b and t both become 3

l (that is el) becomes 4

m and n become 5

r becomes 6

If the result contains two adjacent identical digits, eliminate the second of them.

Keep only the first four characters of what you have left. If you have fewer than four, then add zeros on the end to make the string have length four.

Write a program that carries out the algorithm.

1 Answer

2 votes

Final answer:

The Soundex system is an algorithm that encodes words into a four-character code based on their pronunciation. It follows a set of steps to retain the first letter, delete certain letters, replace remaining letters with numbers, eliminate adjacent identical digits, and keep the first four characters of the resulting code.

Step-by-step explanation:

The Soundex system is an algorithm that encodes a word into a four-character code based on its pronunciation. The algorithm follows a series of steps:

  1. Retain the first letter of the word.
  2. Delete all occurrences of a, e, i, o, u, h, y, and w from the remaining letters.
  3. Replace the remaining letters with numbers according to certain rules.
  4. If there are two adjacent identical digits, eliminate the second one.
  5. Keep only the first four characters of the resulting code, adding zeros if necessary.

To create test cases, pseudocode, and a flowchart, we can use the word "carrot" as an example:

Test Case 1:

Input: carrot

Expected Output: C630

Test Case 2:

Input: caret

Expected Output: C630

Test Case 3:

Input: apple

Expected Output: A140

User Noam Almosnino
by
7.8k points