Question

In: Computer Science

Write an algorithm (flowchart OR Pseudocode) for the following problem Take input character from the user...

Write an algorithm (flowchart OR Pseudocode) for the following problem
Take input character from the user unless he enters '$'. Thereafter display how may vowels were entered by the user. Also display the number of each vowel ('a', 'e', 'i', 'o' and 'u') separately.
For example if the user enters B
a
b
e
c
o
o
d
i
u
g
o
a
l
$
Then we have the output below:
#A=2
#E=1
#I=1
#O=3
#U=2

Solutions

Expert Solution

The algorithm ( pseudo code ) for the problem is given below:

start

count=0 // initialize total vowel count as 0

ac=0,ec=0,ic=0,oc=0,uc=0 // initialize count for a e i o u respectively

while (True)

{

ch = input () // takes the input from user

if (ch== "$")

break    // if input is $ then exit loop

else if(ch == "a") // this section check for "a"

count=count+1 // total count is incremented if the character entered is "a"

ac=ac+1   // count of "a" is incremented

else if(ch == "e") // this section check for "e"

count=count+1 // total count is incremented if the character entered is "e"

ec=ec+1 // count of "e" is incremented

else if(ch == "i")   // this section check for "i"

count=count+1 // total count is incremented if the character entered is "i"

ic=ic+1 // count of "i" is incremented

else if(ch == "o")    // this section check for "o"

count=count+1   // total count is incremented if the character entered is "o"

oc=oc+1    // count of "o" is incremented

else if(ch == "u")   // this section check for "u"

count=count+1   // total count is incremented if the character entered is "u"

uc=uc+1 // count of "u" is incremented

}

print ( "Total number of vowels :" , count) // print total count

print("#A :" , ac ,"\n #E : ", ec,"\n # I : ", ic,"\n #O : ", oc,"\n #U : ", uc) // prints the individual count of each vowel


Related Solutions

Write a Python program that: Create the algorithm in both flowchart and pseudocode forms for the...
Write a Python program that: Create the algorithm in both flowchart and pseudocode forms for the following requirements: Reads in a series of positive integers,  one number at a time;  and Calculate the product (multiplication) of all the integers less than 25,  and Calculate the sum (addition) of all the integers greater than or equal to 25. Use 0 as a sentinel value, which stops the input loop. [ If the input is 0 that means the end of the input list. ]...
Homework Arrays and Tables In this assignment you are to create an algorithm, flowchart, and pseudocode...
Homework Arrays and Tables In this assignment you are to create an algorithm, flowchart, and pseudocode for a solution of the following problem. This solution will include the use of arrays needed to complete all parts of the logic. You have requested to develop a program that will record and process the rainfall totals of a 12 month period. You would use an array to store each months total. Once all 12 months amounts are entered then your solution need...
Make an algorithm in the form of a sentence and flowchart from the following cases: Algorithm...
Make an algorithm in the form of a sentence and flowchart from the following cases: Algorithm for calculating the amount of net salary if known: the amount of base salary, allowances, melting money, taxes, and credit deductions.
Develop an algorithm and a  flowchart for the following: Problem Specification:      Jennifer Camacho It’s the owner...
Develop an algorithm and a  flowchart for the following: Problem Specification:      Jennifer Camacho It’s the owner of Amazing Toyota, a company that sells this type of cars in Puerto Rico. She wants a program that displays the amount of salespersons commission. Some companies use a fixed rate to calculate the commission, while others (like Amazing Toyota) use a rate that varies with the amount of sales. If The salesperson sales $15,000 in one moth his commission will be a 2...
Problem 1: (10 marks) ALGORITHM COMPLEXITY:Write an algorithm (pseudocode but not a program) that takes a...
Problem 1: ALGORITHM COMPLEXITY:Write an algorithm (pseudocode but not a program) that takes a positive numberias an input, where i=a1a2...an,n>=3(numberwith 3 or more digits, every digit can have the value between 0 and 9–both inclusive). The algorithm should find the largest number jsuch that j=b1..bm, 1<=m<=n(numberwith m digits),andevery bk<=bk+1where1<=k<m and bk,bk+1ε{a1, a2, an}.Also, perform the computational complexity (time complexity)analysis of your algorithm and write the algorithm complexity in Big-Oh notation. Examples:Input: 23720, Output: 237Input: 9871, Output: 9Input: 1789, Output:1789Input: 2372891,...
write a progam in python that willl take user input for item and price and save...
write a progam in python that willl take user input for item and price and save them in a dictionary. Then print the item and price and the total price.
JAVA Take in a user input. if user input is "Leap Year" your program should run...
JAVA Take in a user input. if user input is "Leap Year" your program should run exercise 1 if user input is "word count" your program should run exercise 2 Both exercises should run in separate methods Exercise 1: write a java method to check whether a year(integer) entered by the user is a leap year or not. Exercise 2: Write a java method to count all words in a string.
6. Write a program in C programming (compile and run), a pseudocode, and draw a flowchart...
6. Write a program in C programming (compile and run), a pseudocode, and draw a flowchart for each of the following problems: a) Obtain three numbers from the keyboard, compute their product and display the result. b) Obtain two numbers from the keyboard, and determine and display which (if either) is the smaller of the two numbers. c) Obtain a series of positive numbers from the keyboard, and determine and display their average (with 4 decimal points). Assume that the...
Draw a structured flowchart or write pseudocode that describes the process of guessing a number between...
Draw a structured flowchart or write pseudocode that describes the process of guessing a number between 1 and 100. After each guess, the player is told that the guess is too high or too low. The process continues until the player guesses the correct number. Pick a number and have someone try to guess it by following your instructions. Submit the flowchart or pseudocode and the results of your test. Create a python program based on your flowchart or pseudocode....
DESIGN A FLOWCHART IN FLOWGORITHM AND WRITE THE PSEUDOCODE Number Analysis Program Design a program that...
DESIGN A FLOWCHART IN FLOWGORITHM AND WRITE THE PSEUDOCODE Number Analysis Program Design a program that asks the user to enter a series of 20 numbers. The program should store the numbers in an array and then display the following data: The lowest number in the array. The highest number in the array. The total of the numbers in the array. The average of the numbers in the array. PLEASE AND THANK YOU
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT