Професионална програма
Loading...
Reaper041 avatar Reaper041 1 Точки

Задача "Конзолен междувалутен конвертор" проблем

Става дума за задача от книгата "Основи на програмирането". Judge системата ми дава 20/100 точки за решението ми каквото и да направи. Бихте ли ми казали какво мога да променя по кода:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Currency_Calc
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Amount = ");

            var amount = double.Parse(Console.ReadLine());

            Console.Write("From ");

            var fromcur = Console.ReadLine();

            Console.Write("To ");

            var tocur = Console.ReadLine();

            if (fromcur == "BGN" && tocur == "USD")
            {
                Console.WriteLine(amount + " BGN = " + (amount * Math.Round(0.56, 4)) + " USD");
            }
            if (fromcur == "USD" && tocur == "BGN")
            {
                Console.WriteLine(amount + " USD = " + (amount * Math.Round(1.79549, 4)) + " BGN");
            }
            if (fromcur == "BGN" && tocur == "EUR")
            {
                Console.WriteLine(amount + " BGN = " + (amount * Math.Round(0.51, 4)) + " EUR");
            }
            if (fromcur == "EUR" && tocur == "BGN")
            {
                Console.WriteLine(amount + " EUR = " + (amount * Math.Round(1.95583, 4)) + " BGN");
            }
            if (fromcur == "BGN" && tocur == "GBP")
            {
                Console.WriteLine(amount + " BGN = " + (amount * Math.Round(0.43, 4)) + " GBP");
            }
            if (fromcur == "GBP" && tocur == "BGN")
            {
                Console.WriteLine(amount + " GBP = " + (amount * Math.Round(2.53405, 4)) + " BGN");
            }
            if (fromcur == "USD" && tocur == "EUR")
            {
                Console.WriteLine(amount + " USD = " + (amount * Math.Round(0.91, 4)) + " EUR");
            }
            if (fromcur == "EUR" && tocur == "USD")
            {
                Console.WriteLine(amount + " EUR = " + (amount * Math.Round(1.10, 4)) + " USD");
            }
            if (fromcur == "USD" && tocur == "GBP")
            {
                Console.WriteLine(amount + " USD = " + (amount * Math.Round(0.78, 4)) + " GBP");
            }
            if (fromcur == "GBP" && tocur == "USD")
            {
                Console.WriteLine(amount + " GBP = " + (amount * Math.Round(1.29, 4)) + " USD");
            }
            if (fromcur == "GBP" && tocur == "EUR")
            {
                Console.WriteLine(amount + " GBP = " + (amount * Math.Round(1.18, 4)) + " EUR");
            }
            if (fromcur == "EUR" && tocur == "GBP")
            {
                Console.WriteLine(amount + " EUR  = " + (amount * Math.Round(0.85, 4)) + " GBP");
            }
        }
    }
}

 

0
Programming Basics