see attached image

1 answer below »
Answered Same DaySep 06, 2021

Answer To: see attached image

Sayed Shad Ahmad answered on Sep 07 2021
139 Votes
Solution/C# Files/Program1.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//Program_1 namespace
namespace Program_1
{
//Class Program1
class Program1
{
/*
* Method IsV
owel() accepts a character as argument & returns whether the character is vowel or not
* by comparing the character with each of the vowel alphabets in both lower & upper case
* Accepts a character as parameter
* Returns true if the character is vowel, otherwise it returns false
*/
static Boolean IsVowel(char ch)
{
//Declaring and initializing a character array consisting of vowels characters both lower & upper case
char[] vowels = { 'A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u' };
//Repeating for each character in vowels array
for (int i = 0; i < vowels.Length; ++i)
{
//Checking whether the i th character of the vowels array is same as the character supplied as parameter
if (ch == vowels[i])
//Return the value as true when a character of vowels array matches with parameter character
return true;
}
//Return the value as false when none of the character of vowels array matches with parameter character
return false;
}
/*
* Method CountVowels() accepts a string as argument & returns the total number of vowels in the string
* Accepts a string as parameter
* Returns total count of vowels in the string supplied as parameter
*/
static int CountVowels(string s)
{
//Declaring & initializing variable to store count of vowels
int count = 0;
//Repeating for all characters of string s
for (int i = 0; i < s.Length; ++i)
{
//Checking whether the i th character of the string is a vowel or not by calling IsVowel() method
if (IsVowel(s[i]))
//Incrementing the count variable by 1 when the character is a vowel i.e. IsVowel() returned true
++count;
}
//Return the total count of vowels in the string s
return count;
}
//Method Main
static void Main(string[] args)
{
//Requesting user to enter some...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here