using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SimpleClassExample
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("*******Fun with Class Typys******/n");
Car chuck = new Car();
chuck.PrintState();
Car kun = new Car("kun");
kun.PrintState();
Car Marry = new Car("Marry",100);
Marry.PrintState();
Car myCar = new Car();
myCar.petName = "Henry";
myCar.currSpeed = 10;
for (int i=0; i < 10; i++)
{
myCar.SpeedUp(5);
myCar.PrintState();
}
Motorcycle c = new Motorcycle(5);
c.SetDriverName("Tiny");
c.PopAWheelly();
Console.WriteLine("Rider name is {0} ",c.name);
Console.ReadLine();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SimpleClassExample
{
class Car
{
public string petName;
public int currSpeed;
public Car()
{
petName = "chuck";
currSpeed = 50;
}
public Car(string pn)
{
petName = pn;
}
public Car(string pn, int cs)
{
petName = pn;
currSpeed = cs;
}
public void PrintState()
{
Console.WriteLine("{0} is going {1} MPH.",petName,currSpeed);
}
public void SpeedUp(int delta)
{
currSpeed += delta;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SimpleClassExample
{
class Motorcycle
{
public int driverIntensity;
public string name;
public Motorcycle()
{
}
public Motorcycle(int intensity)
{
driverIntensity = intensity;
}
public void SetDriverName(string name)
{
this.name = name;
}
public void PopAWheelly()
{
for (int i = 0; i <= driverIntensity; i++)
{
Console.WriteLine("Yeeeeeee Haaaaawww");
}
}
}
}