Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _08.Metric_Converter
- {
- class MetricConverter
- {
- static void Main(string[] args)
- {
- string m = "m";
- string mm = "mm";
- string cm = "cm";
- string mi = "mi";
- string inches = "in";
- string km = "km";
- string ft = "ft";
- string yd = "yd";
- //metrics
- double mTOmm = 1000;
- double mTOcm = 100;
- double mTOmi = 0.000621371192;
- double mTOin = 39.3700787;
- double mTOkm = 0.001;
- double mTOft = 3.2808399;
- double mTOyd = 1.0936133;
- double amount = double.Parse(Console.ReadLine());
- string input = Console.ReadLine();
- string output = Console.ReadLine();
- if (input == m && output == mm)
- {
- amount *= mTOmm;
- Console.WriteLine("{0} {1}", amount, mm);
- }
- else if (input == mm && output == m)
- {
- amount /= mTOmm;
- Console.WriteLine("{0} {1}", amount, m);
- }
- else if (input == m && output == cm)
- {
- amount *= mTOcm;
- Console.WriteLine("{0} {1}", amount, cm);
- }
- else if (input == cm && output == m)
- {
- amount /= mTOcm;
- Console.WriteLine("{0} {1}", amount, m);
- }
- else if (input == m && output == mi)
- {
- amount *= mTOmi;
- Console.WriteLine("{0} {1}", amount, mi);
- }
- else if (input == mi && output == m)
- {
- amount /= mTOmi;
- Console.WriteLine("{0} {1}", amount, m);
- }
- else if (input == m && output == inches)
- {
- amount *= mTOin;
- Console.WriteLine("{0} {1}", amount, inches);
- }
- else if (input == inches && output == m)
- {
- amount /= mTOin;
- Console.WriteLine("{0} {1}", amount, m);
- }
- else if (input == m && output == km)
- {
- amount *= mTOkm;
- Console.WriteLine("{0} {1}", amount, km);
- }
- else if (input == km && output == m)
- {
- amount /= mTOkm;
- Console.WriteLine("{0} {1}", amount, m);
- }
- else if (input == m && output == ft)
- {
- amount *= mTOft;
- Console.WriteLine("{0} {1}", amount, ft);
- }
- else if (input == ft && output == m)
- {
- amount /= mTOft;
- Console.WriteLine("{0} {1}", amount, m);
- }
- else if (input == m && output == yd)
- {
- amount *= mTOyd;
- Console.WriteLine("{0} {1}", amount, yd);
- }
- else if (input == yd && output == m)
- {
- amount /= mTOyd;
- Console.WriteLine("{0} {1}", amount, m);
- }
- else if (input == mm && output == cm)
- {
- amount /= mTOmm;
- amount *= mTOcm;
- Console.WriteLine("{0} {1}", amount, cm);
- }
- else if (input == cm && output == mm)
- {
- amount = (amount / mTOcm) * mTOmm;
- Console.WriteLine("{0} {1}", amount, mm);
- }
- else if (input == mm && output == mi)
- {
- amount = (amount / mTOmm) * mTOmi;
- Console.WriteLine("{0} {1}", amount, mi);
- }
- else if (input == mi && output == mm)
- {
- amount = (amount / mTOmi) * mTOmm;
- Console.WriteLine("{0} {1}", amount, mm);
- }
- else if (input == mm && output == inches)
- {
- amount = (amount / mTOmm) * mTOin;
- Console.WriteLine("{0} {1}", amount, inches);
- }
- else if (input == inches && output == mm)
- {
- amount = (amount / mTOin) * mTOmm;
- Console.WriteLine("{0} {1}", amount,mm);
- }
- else if (input == mm && output == km)
- {
- amount = (amount / mTOmm) * mTOkm;
- Console.WriteLine("{0} {1}", amount,km);
- }
- else if (input == km && output == mm)
- {
- amount = (amount / mTOkm) * mTOmm;
- Console.WriteLine("{0} {1}", amount,mm);
- }
- else if (input == mm && output == ft)
- {
- amount = (amount / mTOmm) * mTOft;
- Console.WriteLine("{0} {1}", amount,ft);
- }
- else if (input == ft && output == mm)
- {
- amount = (amount / mTOft) * mTOmm;
- Console.WriteLine("{0} {1}", amount,mm);
- }
- else if (input == mm && output == yd)
- {
- amount = (amount / mTOmm) * mTOyd;
- Console.WriteLine("{0} {1}", amount,yd);
- }
- else if (input == yd && output == mm)
- {
- amount = (amount / mTOyd) * mTOmm;
- Console.WriteLine("{0} {1}", amount,mm);
- }
- else if (input == cm && output == mi)
- {
- amount = (amount / mTOcm) * mTOmi;
- Console.WriteLine("{0} {1}", amount,mi);
- }
- else if (input == mi && output == cm)
- {
- amount = (amount / mTOmi) * mTOcm;
- Console.WriteLine("{0} {1}", amount,cm);
- }
- else if (input == cm && output == inches)
- {
- amount = (amount / mTOcm) * mTOin;
- Console.WriteLine("{0} {1}", amount,inches);
- }
- else if (input == inches && output == cm)
- {
- amount = (amount / mTOin) * mTOcm;
- Console.WriteLine("{0} {1}", amount,cm);
- }
- else if (input == cm && output == km)
- {
- amount = (amount / mTOcm) * mTOkm;
- Console.WriteLine("{0} {1}", amount, km);
- }
- else if (input == km && output == cm)
- {
- amount = (amount / mTOkm) * mTOcm;
- Console.WriteLine("{0} {1}", amount, cm);
- }
- else if (input == cm && output == ft)
- {
- amount = (amount / mTOcm) * mTOft;
- Console.WriteLine("{0} {1}", amount, ft);
- }
- else if (input == ft && output == cm)
- {
- amount = (amount / mTOft) * mTOcm;
- Console.WriteLine("{0} {1}", amount, cm);
- }
- else if (input == cm && output == yd)
- {
- amount = (amount / mTOcm) * mTOyd;
- Console.WriteLine("{0} {1}", amount, yd);
- }
- else if (input == yd && output == cm)
- {
- amount = (amount / mTOyd) * mTOcm;
- Console.WriteLine("{0} {1}", amount, cm);
- }
- else if (input == mi && output == inches)
- {
- amount = (amount / mTOmi) * mTOin;
- Console.WriteLine("{0} {1}", amount, inches);
- }
- else if (input == inches && output == mi)
- {
- amount = (amount / mTOin) * mTOmi;
- Console.WriteLine("{0} {1}", amount, mi);
- }
- else if (input == mi && output == km)
- {
- amount = (amount / mTOmi) * mTOkm;
- Console.WriteLine("{0} {1}", amount, km);
- }
- else if (input == km && output == mi)
- {
- amount = (amount / mTOkm) * mTOmi;
- Console.WriteLine("{0} {1}", amount, mi);
- }
- else if (input == mi && output == ft)
- {
- amount = (amount / mTOmi) * mTOft;
- Console.WriteLine("{0} {1}", amount, ft);
- }
- else if (input == ft && output == mi)
- {
- amount = (amount / mTOft) * mTOmi;
- Console.WriteLine("{0} {1}", amount, mi);
- }
- else if (input == mi && output == yd)
- {
- amount = (amount / mTOmi) * mTOyd;
- Console.WriteLine("{0} {1}", amount, yd);
- }
- else if (input == yd && output == mi)
- {
- amount = (amount / mTOyd) * mTOmi;
- Console.WriteLine("{0} {1}", amount, mi);
- }
- else if (input == inches && output == km)
- {
- amount = (amount / mTOin) * mTOkm;
- Console.WriteLine("{0} {1}", amount, km);
- }
- else if (input == km && output == inches)
- {
- amount = (amount / mTOkm) * mTOin;
- Console.WriteLine("{0} {1}", amount, inches);
- }
- else if (input == inches && output == ft)
- {
- amount = (amount / mTOin) * mTOft;
- Console.WriteLine("{0} {1}", amount, ft);
- }
- else if (input == ft && output == inches)
- {
- amount = (amount / mTOft) * mTOin;
- Console.WriteLine("{0} {1}", amount, inches);
- }
- else if (input == inches && output == yd)
- {
- amount = (amount / mTOin) * mTOyd;
- Console.WriteLine("{0} {1}", amount, yd);
- }
- else if (input == yd && output == inches)
- {
- amount = (amount / mTOyd) * mTOin;
- Console.WriteLine("{0} {1}", amount, inches);
- }
- else if (input == km && output == ft)
- {
- amount = (amount / mTOkm) * mTOft;
- Console.WriteLine("{0} {1}", amount, ft);
- }
- else if (input == ft && output == km)
- {
- amount = (amount / mTOft) * mTOkm;
- Console.WriteLine("{0} {1}", amount, km);
- }
- else if (input == km && output == yd)
- {
- amount = (amount / mTOkm) * mTOyd;
- Console.WriteLine("{0} {1}", amount, yd);
- }
- else if (input == yd && output == km)
- {
- amount = (amount / mTOyd) * mTOkm;
- Console.WriteLine("{0} {1}", amount, km);
- }
- else if (input == ft && output == yd)
- {
- amount = (amount / mTOft) * mTOyd;
- Console.WriteLine("{0} {1}", amount, yd);
- }
- else if (input == yd && output == ft)
- {
- amount = (amount / mTOyd) * mTOft;
- Console.WriteLine("{0} {1}", amount, ft);
- }
- else if (input == m && output == m)
- {
- Console.WriteLine(amount);
- }
- else if (input == mm && output == mm)
- {
- Console.WriteLine(amount);
- }
- else if (input == cm && output == cm)
- {
- Console.WriteLine(amount);
- }
- else if (input == mi && output == mi)
- {
- Console.WriteLine(amount);
- }
- else if (input == inches && output == inches)
- {
- Console.WriteLine(amount);
- }
- else if (input == km && output == km)
- {
- Console.WriteLine(amount);
- }
- else if (input == ft && output == ft)
- {
- Console.WriteLine(amount);
- }
- else if (input == yd && output == yd)
- {
- Console.WriteLine(amount);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment