Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

using System; using System.Collections.Generic; using System.Linq; using System.

ID: 3548748 • Letter: U

Question

using System;


using System.Collections.Generic;


using System.Linq;


using System.Text;



namespace FunctionTest

{


    public class Program

    {


        public static void pigTalk(string sentence)

        {


            try

            {


                while (sentence != "exit")

                {


                    string firstLetter;


                    string afterFirst;


                    string pigLatinOut = "";


                    int x;


                    string vowel = "AEIOUaeiou";



                    string[] pieces = sentence.Split();



                    foreach (string piece in pieces)

                    {


                        afterFirst = piece.Substring(1);


                        firstLetter = piece.Substring(0, 1);


                        x = vowel.IndexOf(firstLetter);



                        if (x == -1)

                        {


                            pigLatinOut = (afterFirst + firstLetter + "ay ");


                        }


                        else

                        {


                            pigLatinOut = (firstLetter + afterFirst + "way ");


                        }


                        Console.Write(pigLatinOut);


                    }


                }


            }


            catch (Exception e)

            {


                Console.WriteLine(e.ToString());


            }


        }


    }


}



Getting error "Does not contain static main method suitable for entry point"

Explanation / Answer

using System;


using System.Collections.Generic;


using System.Linq;


using System.Text;



namespace FunctionTest

{


public class Program

{

  

static void Main(string[] args)

{

string sentence = Console.ReadLine();

try

{


while (sentence != "exit")

{


string firstLetter;


string afterFirst;


string pigLatinOut = "";


int x;


string vowel = "AEIOUaeiou";



string[] pieces = sentence.Split();



foreach (string piece in pieces)

{


afterFirst = piece.Substring(1);


firstLetter = piece.Substring(0, 1);


x = vowel.IndexOf(firstLetter);



if (x == -1)

{


pigLatinOut = (afterFirst + firstLetter + "ay ");


}


else

{


pigLatinOut = (firstLetter + afterFirst + "way ");


}


Console.Write(pigLatinOut);


}


}


}


catch (Exception e)

{


Console.WriteLine(e.ToString());


}


}


}


}


The error u were talking about is gone. Some infinite loop is there. U check that out.