Answer to Question #187127 in C# for angelo r reyes

Question #187127

.Write a simple encryption program using string functions which apply the substitution method. Here is the given Substitution Table. Substitution Table: A * E $ I / O + U -


1
Expert's answer
2021-04-30T16:51:02-0400
using System;
using System.Text;

namespace Test
{
    class CapitalTest
    {
        static void Main()
        {
            Console.Write("Enter the string: ");
            string str = Console.ReadLine();

            StringBuilder sb = new StringBuilder();

            for(int i = 0; i < str.Length; ++i)
            {
                switch(str[i])
                {
                    case 'A': sb.Append('*'); break;
                    case 'E': sb.Append('$'); break;
                    case 'I': sb.Append('/'); break;
                    case 'O': sb.Append('+'); break;
                    case 'U': sb.Append('-'); break;
                    default:  sb.Append(str[i]); break;
                }
            }

            Console.WriteLine("Encrypted string: " + sb.ToString());
        }
    }
}

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 the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS