Пример #1
0
        static void Main(string[] args)
        {
            Mahasiswa mhs = new Mahasiswa();

            mhs.npm   = "18.11.2288";
            mhs.nama  = "ANK";
            mhs.email = "*****@*****.**";

            Console.WriteLine("Pilih format konversi data");
            Console.WriteLine("1. Json");
            Console.WriteLine("2. XML");
            Console.WriteLine("3. CSV\n");
            Console.Write("Pilihan anda [1..3]: ");
            int pilih = Convert.ToInt32(Console.ReadLine());

            IConvertObject convert;

            if (pilih == 1)
            {
                convert = new ConvertToJson();
            }
            else if (pilih == 2)
            {
                convert = new ConvertToXml();
            }
            else
            {
                convert = new ConvertToCsv();
            }

            convert.Convert(mhs);
            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            Mahasiswa mhs = new Mahasiswa();
            mhs.npm = "18.11.2324";
            mhs.nama = "Fieancheiza I zaaz Gosani";
            mhs.email = "*****@*****.**";

            Console.WriteLine("Pilih Format Konversi Data :");
            Console.WriteLine("1. Json");
            Console.WriteLine("2. XML");
            Console.WriteLine("3. Csv\n");

            Console.Write("Nomor Format Data [1..3] : ");
            int nomorPrinter = Convert.ToInt32(Console.ReadLine());

            IConvertObject convert;

            if (nomorPrinter == 1)        
                convert = new ConvertToJson();            
            else if (nomorPrinter == 2)            
                convert = new ConvertToXml();          
            else
                convert = new ConvertToCsv();

            convert.Convert(mhs);

            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            Mahasiswa mhs = new Mahasiswa();

            mhs.nmp   = "18.11.2250";
            mhs.nama  = "rizal ahmad z";
            mhs.email = "*****@*****.**";

            Console.WriteLine("Pilih Format konversi data :");
            Console.WriteLine("1. Json");
            Console.WriteLine("2. XML");
            Console.WriteLine("3. Csv\n");

            Console.WriteLine("Nomor Format Data [1...3]");
            int nomorFormatData = Convert.ToInt32(Console.ReadLine());

            IConvertObject convert;

            if (nomorFormatData == 1)
            {
                convert = new ConvertToJson();
            }
            else if (nomorFormatData == 2)
            {
                convert = new ConvertToXml();
            }
            else
            {
                convert = new ConvertToCsv();
            }

            convert.Convert(mhs);

            Console.ReadKey();
        }
Пример #4
0
        static void Main(string[] args)
        {
            Showprint sp = new Showprint();

            sp.print   = "Epson";
            sp.nama    = "Canon";
            sp.printer = "LaserJet";

            Console.WriteLine("Pilih Format Konversi Data : ");
            Console.WriteLine("1. Json");
            Console.WriteLine("2. XML");
            Console.WriteLine("3.Csv\n");

            Console.Write("Nomor Format Data [1..3]: ");
            int nomorFormatData = Convert.ToInt32(Console.ReadLine());

            IPrinterWindows convert;

            if (nomorFormatData == 1)
            {
                convert = new ConvertToJson();
            }
            else if (nomorFormatData == 2)
            {
                convert = new ConvertToXML();
            }
            else
            {
                convert = new ConvertToCsv();
            }


            convert.Convert(sp);
            Console.ReadKey();
        }