Ap 7 Traslator

Wednesday, June 21, 2017

TEXT TO SPEECH IN CONSOLE APPLICATION

note : add new abstract class

 abstract class _absract
{
        public abstract string GetDate();
        public virtual string GetVirtualData()
        {
            string str = "H! I am from Virtual...";
            Console.Write(str);
             return str;
        }

}

step 2: add new 2nd class

using System.Speech.Synthesis;
namespace factorialprog_7.RAJU_MAMA.abstract7
{
    class Non_abstract : _absract
    {
        public override string GetDate()
        {   

            string Time = "The Time Is: " + System.DateTime.Now.ToShortTimeString();
            string Date= "The Date Is: " + System.DateTime.Now.ToShortDateString();
            Console.WriteLine(Time +" " + Date);
            return Time + Date;
        }
        public override string GetVirtualData()
        {
            string str = "Bye I Am From Override...";
            Console.WriteLine(str);
            return str;
        }

        static void Main()
        {
            Non_abstract NA = new Non_abstract();

            SpeechSynthesizer synthesizer = new SpeechSynthesizer();
            synthesizer.Volume = 100;
            synthesizer.Rate = -2;

         
            synthesizer.Speak(NA.GetVirtualData());
            synthesizer.Speak(NA.GetDate());
           
            Console.ReadLine();



        }


    }
}


it's work plz comment if any query


No comments: