Write the following functions. Each of these functions should have a single parameter -- accepting a...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write the following functions. Each of these functions should have a single parameter -- accepting a c-style string as an argument. The function should only do what is specified (note that none of these functions do any output to the screen). Your functions should use const in the prototype wherever it is appropriate: 1. Write a function that counts and returns the number of vowels in the string. (For the purposes of this exercise, we are talking about the standard 5 vowels -- A, E, I, O, U). 2. Write a function that counts and returns the number of consonants in the string. 3. Write a function that converts the string to all lowercase. 4. Write a function that converts the string to all uppercase. Menu program Write a main program that performs the following steps: 1. Prompt the user to enter a string, and let them type it in. This could be an entire sentence, with the newline indicating the end of the string. You may assume the string will be no more than 100 characters, so declare your array accordingly. 2. Display the following menu: 3. A) B) 5. (C) Count the number of vowels in the string Count the number of consonants in the string Convert the string to uppercase Convert the string to lowercase Display the current string 6. D) 7. (E) 8. (F) Enter another string 9. M) Display this menu 10. X) Exit the program 3. Enter a loop, allowing the user to type in a menu choice each time. Loop should continue until the user enters the command to exit. Upper and lowercase letters should be allowed for the menu choices. a. When the A or B commands are entered (counting vowels or consonants), call the corresponding function, then print the result b. When the C or D commands are chosen, just call the appropriate function to convert the string. Do not do any output from main on these commands. c. When E is chosen, print the contents of the stored string. d. When F is chosen, allow a new string to be typed -- this will replace the previous one. e. The menu should only be displayed once at the start, and then again whenever the M option is selected Write the following functions. Each of these functions should have a single parameter -- accepting a c-style string as an argument. The function should only do what is specified (note that none of these functions do any output to the screen). Your functions should use const in the prototype wherever it is appropriate: 1. Write a function that counts and returns the number of vowels in the string. (For the purposes of this exercise, we are talking about the standard 5 vowels -- A, E, I, O, U). 2. Write a function that counts and returns the number of consonants in the string. 3. Write a function that converts the string to all lowercase. 4. Write a function that converts the string to all uppercase. Menu program Write a main program that performs the following steps: 1. Prompt the user to enter a string, and let them type it in. This could be an entire sentence, with the newline indicating the end of the string. You may assume the string will be no more than 100 characters, so declare your array accordingly. 2. Display the following menu: 3. A) B) 5. (C) Count the number of vowels in the string Count the number of consonants in the string Convert the string to uppercase Convert the string to lowercase Display the current string 6. D) 7. (E) 8. (F) Enter another string 9. M) Display this menu 10. X) Exit the program 3. Enter a loop, allowing the user to type in a menu choice each time. Loop should continue until the user enters the command to exit. Upper and lowercase letters should be allowed for the menu choices. a. When the A or B commands are entered (counting vowels or consonants), call the corresponding function, then print the result b. When the C or D commands are chosen, just call the appropriate function to convert the string. Do not do any output from main on these commands. c. When E is chosen, print the contents of the stored string. d. When F is chosen, allow a new string to be typed -- this will replace the previous one. e. The menu should only be displayed once at the start, and then again whenever the M option is selected
Expert Answer:
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these computer network questions
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
When you typically enter a front door to any business, you would normally see right off the bat what that business main focal point is or what their mission statement is. Their primary reasons for...
-
What is the "presentation of self" and why is it important when we are looking at social interaction? explain
-
Define mass and volume flow rates. How are they related to each other?
-
Consider the following: a. Given the following costs and quarterly sales forecasts, use a pure level strategy to design a production plan that will meet demand. What is the cost of the plan? b. The...
-
It looks to me that you have devoted everything to this company and they have treated you badly. Is that right?
-
(Transaction AnalysisService Company) Beverly Crusher is a licensed CPA. During the first month of operations of her business (a sole proprietorship), the following events and transactions occurred....
-
Prove that the series (1+3i)" zn n= 4" n ln (n) converges for all z such that || 2. Here In: (0, ) R is the natural logarithm.
-
Lexington Corporation acquired all of the outstanding common stock of Chalfont, Inc., on January 1, 2016. Lexington gave shares of its no par common stock with a market value of $504 million in...
-
You wanted to take your vacation during the last week in November, but you did not request it because Robert Lawson, who fills in for you when you are absent, had already requested vacation during...
-
What are economies of scope?
-
In September 2015, several acres of sugar crop was damaged due to a faltering monsoon in India, the worlds second-biggest producer of sugar. Farmers in certain states were forced to use damaged crops...
-
What is a capability?
-
What is an acquisition premium?
-
What is a technological discontinuity?
-
Accountancy Company acquired 75% of outstanding ordinary shares of Finance Company for P900,000. Book value of Finance Company's net assets is P1,000,000. Upon re-measurement of acquires net assets,...
-
Information graphics, also called infographics, are wildly popular, especially in online environments. Why do you think infographics continue to receive so much attention? How could infographics be...
-
Repeat the previous programming project, but use a circular linked list to implement the queue. Recall from Figure 12.10 that a circular linked list has one external reference, which is to the lists...
-
Write a for statement to compute the sum 1 + 2 + 3 + 4 + 5 + + n .
-
Write a program that uses the class Calculator in Listing 9.12 to create a more powerful calculator. This calculator will allow you to save one result in memory and call the result back. The commands...
-
To address his concern regarding the previous advisers asset allocation approach, Raye should assess the Laws portfolio using: A. a homogeneous and mutually exclusive asset classbased risk analysis....
-
Raye believes the previous advisers specification for debt is incorrect given that, for purposes of asset allocation, asset classes should be: A. diversifying. B. mutually exclusive. C. relatively...
-
Rayes approach to rebalancing global equities is consistent with: A. the Laws being risk averse. B. global equities having higher transaction costs than other asset classes. C. global equities having...
Study smarter with the SolutionInn App