CSharp - Write program to Output Spanish Day of Week


You will write a program that displays the Spanish version of the day of week for a date entered by the user.


You can find the day of the week using the DayOfWeek property of the DateTime object.

The conversion to Spanish can be made using a series of conditions.


using System;
class Program//  www  . j  av a2s . c  om
    static void Main(string[] args)
        Console.Write("Enter a date: ");
        string input = Console.ReadLine();
        DateTime enteredDate = Convert.ToDateTime(input);

        // Finding day of week (in enumeration) 
        DayOfWeek dayOfWeek = enteredDate.DayOfWeek;

        // Spanish texts 
        string spanish = "";
        if (dayOfWeek == DayOfWeek.Monday)
            spanish = "Lunes";
        if (dayOfWeek == DayOfWeek.Tuesday)
            spanish = "Martes";
        if (dayOfWeek == DayOfWeek.Wednesday)
            spanish = "Miercoles";
        if (dayOfWeek == DayOfWeek.Thursday)
            spanish = "Jueves";
        if (dayOfWeek == DayOfWeek.Friday)
            spanish = "Viernes";
        if (dayOfWeek == DayOfWeek.Saturday)
            spanish = "Sabado";
        if (dayOfWeek == DayOfWeek.Sunday)
            spanish = "Domingo";