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 an algorithm (flowchart OR Pseudocode) for the following problems: Take ten different numbers as input...
Write an algorithm (flowchart OR Pseudocode) for the following problems: Take ten different numbers as input and display the sum of there squares (SS). Example: let the inputs are: 3, 0, -1, 0, 9, -5, 6, 0, 2, 1 then 157 is displayed, because: SS=32+02+(-1)2+02+92+(-5)2+62+02+22+12=157 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...
Write an algorithm (flowchart) for the following problems: Take ten different numbers as input and display...
Write an algorithm (flowchart) for the following problems: Take ten different numbers as input and display the sum of there squares (SS). Example: let the inputs are: 3, 0, -1, 0, 9, -5, 6, 0, 2, 1 then 157 is displayed, because: SS=32+02+(-1)2+02+92+(-5)2+62+02+22+12=157
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. ]...
Define a problem with user input, user output, Switch and some mathematical computation. Write the pseudocode,...
Define a problem with user input, user output, Switch and some mathematical computation. Write the pseudocode, code and display output. Include source code and output. If no output explain the reason why and what you are going to do make sure it does not happen again aka learning from your mistakes. Problem: Pseudocode: Code: Output:
Write the Flowchart for the following programming problem based on the pseudocode below. Last year, a...
Write the Flowchart for the following programming problem based on the pseudocode below. Last year, a local college implemented rooftop gardens as a way to promote energy efficiency and save money. Write a program that will allow the user to enter the energy bills from January to December for the year prior to going green. Next, allow the user to enter the energy bills from January to December of the past year after going green. The program should calculate the...
Write an algorithm and draw a flowchart for the following problem: Create an adaptive cruise control...
Write an algorithm and draw a flowchart for the following problem: Create an adaptive cruise control for a car. Include functions for enabling/disabling the cruise control; setting up the speed. The system should always maintain the speed unless there is a slower car in front of it. Make sure to define inputs and outputs. Do not forget that computer’s microprocessor works in very small steps (tiny steps!), so be careful not to assign large number of steps to one flowchart...
Draw a flowchart and pseudocode that accepts three numbers from a user and displays a message...
Draw a flowchart and pseudocode that accepts three numbers from a user and displays a message if the sum of any two numbers equals the third. Make a working version of this program in Python.
Write an algorithm to describe how to convert a user input from ounces to grams, drams...
Write an algorithm to describe how to convert a user input from ounces to grams, drams and pounds. Use enough detail that you have between five and ten steps. List any assumptions.          a) Assumptions          b) Steps
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...
Write pseudocode for quick find algorithm anf quick union algorithm Write pseudocode for quick find algorithm...
Write pseudocode for quick find algorithm anf quick union algorithm Write pseudocode for quick find algorithm and quick union algorithm
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT