Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Finish the methods in the following code. The instructions for each method are in a comment in the template. DO NOT CHANGE THE MAIN METHOD!

Finish the methods in the following code. The instructions for each method are in a comment in the template. DO NOT CHANGE THE MAIN METHOD!

#include  #include  using namespace std; // prototypes int main() { int answer = 0; int value1 = 0; int value2 = 0; double average = 0; string string1 = ""; int numberVowels = 0; int numberNonVowels = 0; cout << "Enter string1: "; getline(cin, string1); cout << "Enter value1: "; cin >> value1; cout << "Enter value2: "; cin >> value2; cout << endl; cout.setf(ios::fixed); cout.precision(2); answer = summationBetween(value1, value2); cout << "The summation is: " << answer << endl << endl; numberVowels = countVowelsAndOtherCharacters(string1, numberNonVowels); cout << "The string \"" << string1 << "\" has " << numberVowels << " vowels and "; cout << numberNonVowels << " characters that are not vowels. "; cout << endl; cout << endl; average = calculateAverage(); cout << endl; cout << "The average is: " << average << endl; return 0; } // Function: summationBetween // This function adds all the numbers between two numbers. It takes in two integers. // It adds the starting number and the ending number into the sum as well. // The total is returned. // Function: countVowelsAndOtherCharacters // This function counts the number of vowels and the number of nonvowels. It takes in a // string and an integer. It returns the number of vowels. // Function: calculateAverage // This function queries the user for values. It takes in no arguments. // It returns the average of the numbers. 

Sample output using VSCode. Part of the output comes from the main method.

Enter string1: Helloooo Nurse! Enter value1: 3 Enter value2: 5 The summation is: 12 The string "Helloooo Nurse!" has 7 vowels and 8 characters that are not vowels. Type -1 to exit. Enter a number: 2 Enter a number: 3 Enter a number: 10 Enter a number: 32 Enter a number: -1 The average is: 11.75 

Sample output for the same input as above using zyBooks. Part of the output comes from the main method.

Enter string1: Enter value1: Enter value2: The summation is: 12 The string "Helloooo Nurse!" has 7 vowels and 8 characters that are not vowels. Type -1 to exit. Enter a number: Enter a number: Enter a number: Enter a number: Enter a number: The average is: 11.75

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Statistical And Scientific Database Management International Working Conference Ssdbm Rome Italy June 21 23 1988 Proceedings Lncs 339

Authors: Maurizio Rafanelli ,John C. Klensin ,Per Svensson

1st Edition

354050575X, 978-3540505754

More Books

Students also viewed these Databases questions