Question: Design a program that asks the user to enter a string The string will then be displayed back to the user This is followed by
Design a program that asks the user to enter a string
The string will then be displayed back to the user
This is followed by determining the number of
alphabetic characters
numeric characters
lowercase letters
uppercase letters
whitespace characters
and then displaying them
The user should be given additional chances to enter additional strings
and each time a string is entered, the above process is to be performed
The inputting is to stop, when the user enters "end" as the input string
At that point, total number of
alphabetic characters
numeric characters
lowercase letters
uppercase letters
whitespace characters
are to be displayed and the program terminated
An algorithm:
Prompt the user to enter a string at the keyboard
As long as the string is not "end"
Display the string, along with an appropriate message
Examine the current character of the string
If it's alphabetic, update the alphabeticcounter and the totalalphabeticcounter
If it's numeric, update the numeric counter and the totalnumericcounter
If it's a lowercase letter, update the lowercase counter and the totallowercasecounter
If it's a uppercase letter, update the uppercase counter and the totaluppercasecounter
If it's a whitespace character, update the whitespace counter and the totalwhitespacecounter
Continue from step with the next character until done with this string
Display the alphabeticcounter, numeric counter, lowercase counter, uppercase counter, and whitespace counter, each on a separate line, and each along with an appropriate message
Prompt the user to enter another string at the keyboard
Display the totalalphabeticcounter, total numeric counter, totallowercase counter, total uppercase counter, and total whitespace counter, each on a separate line, and each along with an appropriate message
Stop
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
