Berchev

Untitled

Mar 6th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 12.25 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _08.Metric_Converter
  8. {
  9.     class MetricConverter
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string m = "m";
  14.             string mm = "mm";
  15.             string cm = "cm";
  16.             string mi = "mi";
  17.             string inches = "in";
  18.             string km = "km";
  19.             string ft = "ft";
  20.             string yd = "yd";
  21.  
  22.             //metrics
  23.  
  24.             double mTOmm = 1000;
  25.             double mTOcm = 100;
  26.             double mTOmi = 0.000621371192;
  27.             double mTOin = 39.3700787;
  28.             double mTOkm = 0.001;
  29.             double mTOft = 3.2808399;
  30.             double mTOyd = 1.0936133;
  31.  
  32.             double amount = double.Parse(Console.ReadLine());
  33.             string input = Console.ReadLine();
  34.             string output = Console.ReadLine();
  35.  
  36.  
  37.             if (input == m && output == mm)
  38.             {
  39.                 amount *= mTOmm;
  40.                 Console.WriteLine("{0} {1}", amount, mm);
  41.             }
  42.             else if (input == mm && output == m)
  43.             {
  44.                 amount /= mTOmm;
  45.                 Console.WriteLine("{0} {1}", amount, m);
  46.  
  47.             }
  48.             else if (input == m && output == cm)
  49.             {
  50.                 amount *= mTOcm;
  51.                 Console.WriteLine("{0} {1}", amount, cm);
  52.             }
  53.             else if (input == cm && output == m)
  54.             {
  55.                 amount /= mTOcm;
  56.                 Console.WriteLine("{0} {1}", amount, m);
  57.             }
  58.             else if (input == m && output == mi)
  59.             {
  60.                 amount *= mTOmi;
  61.                 Console.WriteLine("{0} {1}", amount, mi);
  62.             }
  63.             else if (input == mi && output == m)
  64.             {
  65.                 amount /= mTOmi;
  66.                 Console.WriteLine("{0} {1}", amount, m);
  67.             }
  68.             else if (input == m && output == inches)
  69.             {
  70.                 amount *= mTOin;
  71.                 Console.WriteLine("{0} {1}", amount, inches);
  72.             }
  73.             else if (input == inches && output == m)
  74.             {
  75.                 amount /= mTOin;
  76.                 Console.WriteLine("{0} {1}", amount, m);
  77.             }
  78.             else if (input == m && output == km)
  79.             {
  80.                 amount *= mTOkm;
  81.                 Console.WriteLine("{0} {1}", amount, km);
  82.             }
  83.             else if (input == km && output == m)
  84.             {
  85.                 amount /= mTOkm;
  86.                 Console.WriteLine("{0} {1}", amount, m);
  87.             }
  88.             else if (input == m && output == ft)
  89.             {
  90.                 amount *= mTOft;
  91.                 Console.WriteLine("{0} {1}", amount, ft);
  92.             }
  93.             else if (input == ft && output == m)
  94.             {
  95.                 amount /= mTOft;
  96.                 Console.WriteLine("{0} {1}", amount, m);
  97.             }
  98.             else if (input == m && output == yd)
  99.             {
  100.                 amount *= mTOyd;
  101.                 Console.WriteLine("{0} {1}", amount, yd);
  102.             }
  103.             else if (input == yd && output == m)
  104.             {
  105.                 amount /= mTOyd;
  106.                 Console.WriteLine("{0} {1}", amount, m);
  107.             }
  108.             else if (input == mm && output == cm)
  109.             {
  110.                 amount /= mTOmm;
  111.                 amount *= mTOcm;
  112.                 Console.WriteLine("{0} {1}", amount, cm);
  113.             }
  114.             else if (input == cm && output == mm)
  115.             {
  116.                 amount = (amount / mTOcm) * mTOmm;
  117.                 Console.WriteLine("{0} {1}", amount, mm);
  118.             }
  119.             else if (input == mm && output == mi)
  120.             {
  121.                 amount = (amount / mTOmm) * mTOmi;
  122.                 Console.WriteLine("{0} {1}", amount, mi);
  123.             }
  124.             else if (input == mi && output == mm)
  125.             {
  126.                 amount = (amount / mTOmi) * mTOmm;
  127.                 Console.WriteLine("{0} {1}", amount, mm);
  128.             }
  129.             else if (input == mm && output == inches)
  130.             {
  131.                 amount = (amount / mTOmm) * mTOin;
  132.                 Console.WriteLine("{0} {1}", amount, inches);
  133.             }
  134.             else if (input == inches && output == mm)
  135.             {
  136.                 amount = (amount / mTOin) * mTOmm;
  137.                 Console.WriteLine("{0} {1}", amount,mm);
  138.             }
  139.             else if (input == mm && output == km)
  140.             {
  141.                 amount = (amount / mTOmm) * mTOkm;
  142.                 Console.WriteLine("{0} {1}", amount,km);
  143.             }
  144.             else if (input == km && output == mm)
  145.             {
  146.                 amount = (amount / mTOkm) * mTOmm;
  147.                 Console.WriteLine("{0} {1}", amount,mm);
  148.             }
  149.             else if (input == mm && output == ft)
  150.             {
  151.                 amount = (amount / mTOmm) * mTOft;
  152.                 Console.WriteLine("{0} {1}", amount,ft);
  153.             }
  154.             else if (input == ft && output == mm)
  155.             {
  156.                 amount = (amount / mTOft) * mTOmm;
  157.                 Console.WriteLine("{0} {1}", amount,mm);
  158.             }
  159.             else if (input == mm && output == yd)
  160.             {
  161.                 amount = (amount / mTOmm) * mTOyd;
  162.                 Console.WriteLine("{0} {1}", amount,yd);
  163.             }
  164.             else if (input == yd && output == mm)
  165.             {
  166.                 amount = (amount / mTOyd) * mTOmm;
  167.                 Console.WriteLine("{0} {1}", amount,mm);
  168.             }
  169.             else if (input == cm && output == mi)
  170.             {
  171.                 amount = (amount / mTOcm) * mTOmi;
  172.                 Console.WriteLine("{0} {1}", amount,mi);
  173.             }
  174.             else if (input == mi && output == cm)
  175.             {
  176.                 amount = (amount / mTOmi) * mTOcm;
  177.                 Console.WriteLine("{0} {1}", amount,cm);
  178.             }
  179.             else if (input == cm && output == inches)
  180.             {
  181.                 amount = (amount / mTOcm) * mTOin;
  182.                 Console.WriteLine("{0} {1}", amount,inches);
  183.             }
  184.             else if (input == inches && output == cm)
  185.             {
  186.                 amount = (amount / mTOin) * mTOcm;
  187.                 Console.WriteLine("{0} {1}", amount,cm);
  188.             }
  189.             else if (input == cm && output == km)
  190.             {
  191.                 amount = (amount / mTOcm) * mTOkm;
  192.                 Console.WriteLine("{0} {1}", amount, km);
  193.             }
  194.             else if (input == km && output == cm)
  195.             {
  196.                 amount = (amount / mTOkm) * mTOcm;
  197.                 Console.WriteLine("{0} {1}", amount, cm);
  198.             }
  199.             else if (input == cm && output == ft)
  200.             {
  201.                 amount = (amount / mTOcm) * mTOft;
  202.                 Console.WriteLine("{0} {1}", amount, ft);
  203.             }
  204.             else if (input == ft && output == cm)
  205.             {
  206.                 amount = (amount / mTOft) * mTOcm;
  207.                 Console.WriteLine("{0} {1}", amount, cm);
  208.             }
  209.             else if (input == cm && output == yd)
  210.             {
  211.                 amount = (amount / mTOcm) * mTOyd;
  212.                 Console.WriteLine("{0} {1}", amount, yd);
  213.             }
  214.             else if (input == yd && output == cm)
  215.             {
  216.                 amount = (amount / mTOyd) * mTOcm;
  217.                 Console.WriteLine("{0} {1}", amount, cm);
  218.             }
  219.             else if (input == mi && output == inches)
  220.             {
  221.                 amount = (amount / mTOmi) * mTOin;
  222.                 Console.WriteLine("{0} {1}", amount, inches);
  223.             }
  224.             else if (input == inches && output == mi)
  225.             {
  226.                 amount = (amount / mTOin) * mTOmi;
  227.                 Console.WriteLine("{0} {1}", amount, mi);
  228.             }
  229.             else if (input == mi && output == km)
  230.             {
  231.                 amount = (amount / mTOmi) * mTOkm;
  232.                 Console.WriteLine("{0} {1}", amount, km);
  233.             }
  234.             else if (input == km && output == mi)
  235.             {
  236.                 amount = (amount / mTOkm) * mTOmi;
  237.                 Console.WriteLine("{0} {1}", amount, mi);
  238.             }
  239.             else if (input == mi && output == ft)
  240.             {
  241.                 amount = (amount / mTOmi) * mTOft;
  242.                 Console.WriteLine("{0} {1}", amount, ft);
  243.             }
  244.             else if (input == ft && output == mi)
  245.             {
  246.                 amount = (amount / mTOft) * mTOmi;
  247.                 Console.WriteLine("{0} {1}", amount, mi);
  248.             }
  249.             else if (input == mi && output == yd)
  250.             {
  251.                 amount = (amount / mTOmi) * mTOyd;
  252.                 Console.WriteLine("{0} {1}", amount, yd);
  253.             }
  254.             else if (input == yd && output == mi)
  255.             {
  256.                 amount = (amount / mTOyd) * mTOmi;
  257.                 Console.WriteLine("{0} {1}", amount, mi);
  258.             }
  259.             else if (input == inches && output == km)
  260.             {
  261.                 amount = (amount / mTOin) * mTOkm;
  262.                 Console.WriteLine("{0} {1}", amount, km);
  263.             }
  264.             else if (input == km && output == inches)
  265.             {
  266.                 amount = (amount / mTOkm) * mTOin;
  267.                 Console.WriteLine("{0} {1}", amount, inches);
  268.             }
  269.             else if (input == inches && output == ft)
  270.             {
  271.                 amount = (amount / mTOin) * mTOft;
  272.                 Console.WriteLine("{0} {1}", amount, ft);
  273.             }
  274.             else if (input == ft && output == inches)
  275.             {
  276.                 amount = (amount / mTOft) * mTOin;
  277.                 Console.WriteLine("{0} {1}", amount, inches);
  278.             }
  279.             else if (input == inches && output == yd)
  280.             {
  281.                 amount = (amount / mTOin) * mTOyd;
  282.                 Console.WriteLine("{0} {1}", amount, yd);
  283.             }
  284.             else if (input == yd && output == inches)
  285.             {
  286.                 amount = (amount / mTOyd) * mTOin;
  287.                 Console.WriteLine("{0} {1}", amount, inches);
  288.             }
  289.             else if (input == km && output == ft)
  290.             {
  291.                 amount = (amount / mTOkm) * mTOft;
  292.                 Console.WriteLine("{0} {1}", amount, ft);
  293.             }
  294.             else if (input == ft && output == km)
  295.             {
  296.                 amount = (amount / mTOft) * mTOkm;
  297.                 Console.WriteLine("{0} {1}", amount, km);
  298.             }
  299.             else if (input == km && output == yd)
  300.             {
  301.                 amount = (amount / mTOkm) * mTOyd;
  302.                 Console.WriteLine("{0} {1}", amount, yd);
  303.             }
  304.             else if (input == yd && output == km)
  305.             {
  306.                 amount = (amount / mTOyd) * mTOkm;
  307.                 Console.WriteLine("{0} {1}", amount, km);
  308.             }
  309.             else if (input == ft && output == yd)
  310.             {
  311.                 amount = (amount / mTOft) * mTOyd;
  312.                 Console.WriteLine("{0} {1}", amount, yd);
  313.             }
  314.             else if (input == yd && output == ft)
  315.             {
  316.                 amount = (amount / mTOyd) * mTOft;
  317.                 Console.WriteLine("{0} {1}", amount, ft);
  318.             }
  319.             else if (input == m && output == m)
  320.             {
  321.                 Console.WriteLine(amount);
  322.             }
  323.             else if (input == mm && output == mm)
  324.             {
  325.                 Console.WriteLine(amount);
  326.             }
  327.             else if (input == cm && output == cm)
  328.             {
  329.                 Console.WriteLine(amount);
  330.             }
  331.             else if (input == mi && output == mi)
  332.             {
  333.                 Console.WriteLine(amount);
  334.             }
  335.             else if (input == inches && output == inches)
  336.             {
  337.                 Console.WriteLine(amount);
  338.             }
  339.             else if (input == km && output == km)
  340.             {
  341.                 Console.WriteLine(amount);
  342.             }
  343.             else if (input == ft && output == ft)
  344.             {
  345.                 Console.WriteLine(amount);
  346.             }
  347.             else if (input == yd && output == yd)
  348.             {
  349.                 Console.WriteLine(amount);
  350.             }
  351.  
  352.         }
  353.     }
  354. }
Advertisement
Add Comment
Please, Sign In to add comment