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

I am trying to write a program for the proposed problem: File Textese.txt contai

ID: 3571491 • Letter: I

Question

I am trying to write a program for the proposed problem: File Textese.txt contains pairs of English words and their text equivalents. Write a program that requests an English sentence as input and translates it into Textese. Assume that there is no punctuation in the English sentence. (Note: If a word in the sentence is not in the text file, it should appear as itself in the Textese translation.)

I have wrote the following code for this problem:

Public Class frmTranslate

Private Sub btnTranslate_Click(sender As Object, e As EventArgs) Handles btnTranslate.Click

Dim data() As String

Dim search() As String

Dim input As String = txtEnglish.Text

Dim sentence() As String = IO.File.ReadAllLines("Textese.txt")

Dim English(sentence.Length - 1) As String

Dim Textese(sentence.Length - 1) As String

For field As Integer = 0 To sentence.Length - 1

data = sentence(field).Split(","c)

English(field) = data(0)

Textese(field) = data(1)

Next

Dim texteseText As String = ""

search = txtEnglish.Text.Split(" "c)

For i As Integer = 0 To search.Length - 1

For j As Integer = 0 To English.Length - 1

If English(j) = search(i).ToUpper() Then

texteseText += Textese(j) + " "

End If

Next

Next

txtTextese.Text = texteseText

End Sub

End Class

Textese Translator English Sentence enjoy the great band Emma Translate Sentence Textese Sentence njoy the gr8 b& Emma

Explanation / Answer

Structure Dist

        Dim english As String

        Dim french As String

        Dim german As String

    End Structure

    Dim translation() As Dist

   

    Private Sub Project_3_pp342_343_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim Dist() As String = IO.File.ReadAllLines("Textese.txt")

        Dim n As Integer = Dist.Count - 1

        ReDim translation(n)

        Dim line As String

        Dim data() As String

        For i As Integer = 0 To n

            line = Dist(i)

            data = line.Split(","c)

            translation(i).english = data(0)

            translation(i).french = data(1)

            translation(i).german = data(2)

        Next

    End Sub

    Private Sub btnTranslate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTranslate.Click

        Dim sentence() As String = txtSentence.Text.ToUpper.Replace(".", "").Split(" "c)

        Dim frenchSentence(sentence.Count - 1) As String

        Dim germanSentence(sentence.Count - 1) As String

        txtFrench.Clear()

        txtGerman.Clear()

        Dim count As Integer = sentence.Count - 1

        For i = 0 To count

            Dim query = From word In translation

                        Where word.english = sentence(count)

                        Select word.french, word.german

            For Each portion In query

                frenchSentence(count) = portion.french

                germanSentence(count) = portion.german

            Next

            txtFrench.Text = String.Join(" ", frenchSentence)

            txtGerman.Text = String.Join(" ", germanSentence)

        Next

       

    End Sub

End Class

here is the text file used as reference "Textese.txt"

LARGE,GROS,GROSS

NO,NON,NEIN

HAT,CHAPEAU,HUT

PENCIL,CRAYON,BLEISTIFT

RED,ROUGE,ROT

ON,SUR,AUF

AUTO,AUTO,AUTO

OFTEN,SOUVENT,OF

YES,OUI,JA

TABLE,TABLE,TISCH

THE,LA,DEM

IS,EST,IST

YELLOW,JAUNE,GELB

FRIEND,AMI,FREUND

SICK,MALADE,KRANK

MY,MON,MEIN

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote