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

Question #180556

6.2. Write a program using string functions that accepts a coded value of an item and display its equivalent tag price. The base of the key is: 0 1 2 3 4 5 6 7 8 9 ----- X C O M P U T E R S Sample input/output dialogue: Enter coded value: TR.XX Tag price: 68.00


1
Expert's answer
2021-04-13T14:29:38-0400
sing 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 coded value: ");
            string price = Console.ReadLine();
            string coded = price.Replace("X", "0").Replace("C", "1").Replace("O", "2").Replace( "M", "3").Replace("P","4").Replace("U","5").Replace("T","6").Replace("E","7").Replace("R","8").Replace("S","9");
            Console.WriteLine("Tag price: " + 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