Answer to Question #180552 in C# for Patrick Ian Kyle Mabunay

Question #180552

Write a program using standard string functions that accepts a price of an item and display its coded value. The base of the key is: X C O M P U T E R S 1 2 3 4 5 6 7 8 9 Sample input/output dialogue: Enter price: 489.50 Coded value: PRS.UX


1
Expert's answer
2021-04-12T07:26:46-0400
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Enter Price: ");
            string price = Console.ReadLine();
            string coded = price.Replace("0", "X").Replace("1", "C").Replace("2", "O").Replace("3", "M").Replace("4", "P").Replace("5", "U").Replace("6", "T").Replace("7", "E").Replace("8", "R").Replace("9", "S");
            Console.WriteLine("Coded Value: " + coded);
        }
    }
}

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