Great Deal! Get Instant $10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

see attached image

1 answer below »
Answered Same Day Sep 06, 2021

Solution

Sayed Shad Ahmad answered on Sep 07 2021
142 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 IsVowel() 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 paramete
* Returns true if the character is vowel, otherwise it returns false
*
static Boolean IsVowel(char ch)
{

Declaring and initializing a character a
ay 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 a
ay
for (int i = 0; i < vowels.Length; ++i)
{

Checking whether the i th character of the vowels a
ay is same as the character supplied as paramete
if (ch == vowels[i])

Return the value as true when a character of vowels a
ay matches with parameter characte
return true;
}

Return the value as false when none of the character of vowels a
ay matches with parameter characte
return false;
}
/*
* Method CountVowels() accepts a string as argument & returns the total number of vowels in the string
* Accepts a string as paramete
* Returns total count of vowels in the string supplied as paramete
*
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