My assignment is to create in pseudocode a module that accepts a 200 element array of alpha characters. How do I write the code to choose the 200 characters at random and put them in an array?
My full assignment is:
Create a module in pseudocode which accepts a 200 element array of characters, determines the number of occurrences of each of the five vowels in the array (a, e, i, o, u), and prints the number of occurrences of each vowel to the screen. [25 pts]
I am sure there is an easier way of putting this but this is what I figured out:
Module vowels(characterArray)
Declare Boolean found
Declare Integer Index
Declare Integer vowelA
Declare Integer vowelE
Declare Integer vowelI
Declare Integer vowelO
Declare Integer vowelU
Set found = false
Set index = 0
Set vowelA = 0
Set vowelE = 0
Set vowelI = 0
Set vowelO = 0
Set vowelU = 0
While found == false AND index <= size – 1
If characterArray[index] == ucase$(“a”)
Set vowelA = vowelA + 1
If characterArray[index] == ucase$( “e”)
Set vowelE = vowelE + 1
If characterArray[index] == ucase$( “i”)
Set vowelI = vowelI + 1
If characterArray[index] == ucase$( “o”)
Set vowelO = vowelO + 1
If characterArray[index] == ucase$( “u”)
Set vowelU = vowelU + 1
Else
Set found = true
Endif
Endif
Endif
Endif
Endif
Endwhile
Display “Number of A’s: “ ,vowelA
Display “Number of E’s: “ ,vowelE
Display “Number of I’s: “ ,vowelI
Display “Number of O’s: “ ,vowelO
Display “Number of U’s: “ ,vowelU
End Module