Demo entry 5873496

pws

   

Submitted by anonymous on Aug 25, 2016 at 15:00
Language: C#. Code size: 1.7 kB.

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

namespace pws1
{
    class planeet
    {
        public string naam;
	    public double massa;
        public bool atmosfeer;
        public double valversnelling;
        public double diameter;
        public string kleur;

        public planeet(string naam, double massa, bool atmosfeer, double valversnelling, double diameter, string kleur)
        {
            this.naam = naam;
            this.massa = massa;
            this.atmosfeer = atmosfeer;
            this.valversnelling = valversnelling;
            this.diameter = diameter;
            this.kleur = kleur;
        }
    };


    class Program
    {
        static void Main(string[] args)
        {
            List<planeet> zonnestelsel = new List<planeet>();

            zonnestelsel.Add(new planeet("planeet1", 41233, true, 2.3, 200, "Rood"));
            zonnestelsel.Add(new planeet("planeet2", 555512333, true, 55, 4000, "Geel"));
            zonnestelsel.Add(new planeet("planeet3", 123124544, true, 3.4, 1004, "Blauw"));
            zonnestelsel.Add(new planeet("planeet4", 1212345444, true, 7.9, 12333, "Oranje"));
            zonnestelsel.Add(new planeet("planeet5", 1233334455, true, 8.4, 2099, "Grijs"));

            for (int i = 0; i < 4; i++)
            {
                Console.WriteLine(zonnestelsel[i].naam + ", " + zonnestelsel[i].massa + ", " + zonnestelsel[i].atmosfeer + ", " + zonnestelsel[i].valversnelling + ", "
                + zonnestelsel[i].diameter + ", " + zonnestelsel[i].kleur);
            }
            Console.ReadKey();
        }
    }
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).