Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write the Pseudocode for the following algorithms: For example: Declare Integer

ID: 3771431 • Letter: W

Question

Write the Pseudocode for the following algorithms:

For example:

Declare Integer index

Declare Integer numDigits = 0

For index = 0 To length(str) - 1

   If isDigit( str[index] ) Then

Set numDigits = numDigits + 1

   End If

End For

Display "The number of digits is ", numDigits

1. Design a pseudocode algorithm that counts the number of digits that appear in the String variable str.

2. Design a pseudocode algorithm that counts the number of lowercase characters that appear in the String variable str.

3. Design a pseudocode algorithm that counts the number of uppercase characters that appear in the String variable str.

4. Design a pseudocode algorithm that deletes the first and last characters in the String variable str.

5. Design a pseudocode algorithm that converts each occurrence of the character "t" in the String variable str to uppercase.

6. Design a pseudocode algorithm that replaces each occurrence of the character "x" in the String variable str with a space.

7. Assume that the following declaration exists in a program:

Declare String str = "Mr. Bean"

Design a pseudocode algorithm that replaces "Mr." with "Mister" in the variable.

Explanation / Answer

Multiple Questions :1st already answered and given as example. Answering 2 and 3 :

Qn 2:

Declare Integer index
Declare Integer numLower = 0
For index = 0 To length(str) - 1
   If isLower( str[index] ) Then
      Set numLower = numLower + 1
   End If
End For
Display "The number of lower case character is ", numLower

Qn 3:

Declare Integer index
Declare Integer numUpper = 0
For index = 0 To length(str) - 1
   If isUpper( str[index] ) Then
      Set numUpper = numUpper + 1
   End If
End For
Display "The number of Upper case character is ", numUpper

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote