Answer to Question #327779 in C# for chi

Question #327779

Machine Problem 6.7

Write a program using string functions that will accept the name of the capital as input value and will display the corresponding country.


CAPITALS COUNTRIES

Ottawa Canada

Washington D.C. United States

Moscow Russia

Rome Italy

Manila Philippines


1
Expert's answer
2022-04-12T16:18:23-0400
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ComputeAverageApp
{
    class ComputeAverageProgram
    {
        static void Main(string[] args)
        {
 
            Console.Write("Enter the capital: ");
            string capital = Console.ReadLine();
            string country = "";

            if (capital.ToLower() == "Ottawa".ToLower())
                country = "Canada";
            if (capital.ToLower() == "Washington D.C".ToLower())
                country = "United States";
            if (capital.ToLower() == "Moscow".ToLower())
                country = "Russia";
            if (capital.ToLower() == "Rome".ToLower())
                country = "Italy";
            if (capital.ToLower() == "Manila".ToLower())
                country = "Philippines";

            Console.WriteLine("Country: " + country);
            Console.ReadLine();
        }
    }
}

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