60 429
Assignments Done
98,1%
Successfully Done
In April 2018

Answer to Question #60185 in C# for RD

Question #60185
Write a program in C++ to input a single character and print a message― it is vowel" if it is vowel otherwise print message "It is a "consonant― Use if-else structure and OR (||) operator only.

Expert's answer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Question
{

class Letter_Class
{
private char letter;

public char Letter
{
get { return letter; }
set { letter = value; }
}

public bool IsVowel()
{
char letterUp = Char.ToUpper(letter);
if (letterUp == 'A' || letterUp == 'O' || letterUp == 'U' || letterUp == 'I' || letterUp == 'E')
return true;
else
return false;
}
}
class Program
{
static void Main(string[] args)
{
Console.Write("Input letter: ");
char letter = Console.ReadKey().KeyChar;
Console.WriteLine();
Letter_Class LetterObj = new Letter_Class();
LetterObj.Letter = letter;

if (LetterObj.IsVowel())
Console.WriteLine("It is a vowel!");
else
Console.WriteLine("It is a consonaut!");

}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions