Sabtu, 06 April 2013

Merancang Mobil Dengan Fungsi menggunakan C#





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

namespace Materi6B
{
    public class Atap
    {
        public void AtapMobil()
        {
        Console.WriteLine("              + + + + + + +");
        Console.WriteLine("             +         +         +");
        Console.WriteLine("            +          +           +");
        }
    }

    public class Badan
    {
        public void BadanMobil()
        {
        Console.WriteLine("       + + + + + + + + + + + + + +");
        Console.WriteLine("      +                                              +");
        Console.WriteLine(" + + +                                              +");
        Console.WriteLine("+                                                     +");
        Console.WriteLine(" + + + + + + + + + + + + + + + + +");
        }
    }

    public class Roda
    {
        public void RodaMobil()
        {
        Console.WriteLine("            + + +            + + +");
        Console.WriteLine("           +  o  +          +  o  +");
        Console.WriteLine("            + + +            + + +");
        }
    }
    public class Mobil
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Membuat Mobil Keren Dengan Fungsi\n");
            Atap A = new Atap();
            Badan B = new Badan();
            Roda R = new Roda();

            A.AtapMobil();
            B.BadanMobil();
            R.RodaMobil();

            Console.ReadLine();

        }
    }
}

0 komentar:

Posting Komentar