using System.Collections.Generic;
string reTweet = "I am tweeting woohoo!";
decimal MoneyInBank = 100000000M;
double StuffOfNumbers = 24.5D;
int myFavoriteNumber = 45;
Console.WriteLine(reTweet);
Console.WriteLine("I have {0} dollars in the bank!", MoneyInBank);
Console.WriteLine( myFavoriteNumber + StuffOfNumbers);
Console.WriteLine("I'm doing something...");
public int AddNumbers(int number1, int number2) {
int result = number1 + number2;
int result = AddNumbers(11, 2);
Console.WriteLine(result);
Console.WriteLine("I am very short, correct? {0}", IsShort());
Console.WriteLine("num1 is larger than num2");
} else if (num2 > num1) {
Console.WriteLine("num2 is larger than num1");
Console.WriteLine("They are equal");
for (int i = 0; i < 5; i++) {
string[] Pets = {"dog","cat","bird"};
foreach (string value in Pets) {
Console.WriteLine(value);
Console.WriteLine("Something ");
for (int i = 0; i <= 10; i++) {
Console.WriteLine(string.IsNullOrEmpty(result) ? i.ToString() : result);
public static void Main()
Dictionary<string, string> favoriteActorMovie = new Dictionary<string, string>()
{"Samuel Jackson", "Pulp Fiction"}
Dictionary<string, string> academywinners = new Dictionary<string, string>()
{"American Beauty", "2000"},
{"A Beautiful Mind", "2002"},
{"Lord of the Rings: The Return of the King", "2004"},
{"Million Dollar Baby", "2005"}
foreach (var winners in academywinners) {
Console.WriteLine(winners);
public static void Main2()
Laptop [] laptop = new Laptop[4];
laptop [0] = new Laptop("M17", "Alienware", "17.5");
laptop [1] = new Laptop("ApplePro", "Apple", "13");
laptop [2] = new Laptop("Pro", "MSI", "14.5");
laptop [3] = new Laptop("Lion", "Apple", "12");
foreach (var Laptop in laptop) {
public Laptop(string type, string company, string screen)
public string Type { get; set;}
public string Company { get; set;}
public string Screen { get; set;}
public void LaptopInfo() {
Console.WriteLine("I have a {0} {1} laptop with a screen size of {2}.", this.Type, this.Company, this.Screen);
public static void Main3()
Country honduras = new Country("Honduras", "Tegucigalpa");
Country russia = new Country("Russia", "Moscow");
Country france = new Country("France", "Paris");
Country uae = new Country("United Arab Emirates", "Abu Dhabi");
Country[] countries = new Country[6];
countries[0] = new Country("Guatemala", "Guatemala City");
countries[1] = new Country("Peru", "Lima");
countries[2] = new Country("The United States", "Washington D.C.");
countries[3] = new Country("Spain", "Madrid");
countries[4] = new Country("Pakistan", "Islamabad");
countries[5] = new Country("Senegal", "Dakar");
foreach (var country in countries) {
public Country(string name, string capital)
public string Name { get; set; }
public string Capital { get; set; }
public void GiveBasics(){
Console.WriteLine("The capital of {0} is {1}.", this.Name, this.Capital);
public abstract class Animal
public string latinName { get; set; }
public int numberOfLegs { get; set;}
public int weight { get; set;}
public int averageNumOffspring { get; set;}
public string habitat { get; set;}
public bool hasFur { get; set;}
public bool hasWings { get; set;}
public bool canFly { get; set;}
Console.WriteLine("I am an animal.");
public virtual void GetMad()
Console.WriteLine("ROAR!!!");
Console.WriteLine ("I just ate a hiker");
public bool handlesBusinessInWoods { get; set;}
public bool hibernates { get; set;}
public bool stealsPicnicBaskets { get; set;}
public int numberOfSalmonPerDay { get; set;}
public string temperatureOfPorridge { get; set;}
public override void GetMad(){
Console.WriteLine("Hissssss!");
public override void GetMad() {
Console.WriteLine("BARK BARK BARK!");
public override void GetMad() {
Console.WriteLine("meowww");
public override void GetMad() {
Console.WriteLine("BLHELEHLBHE");
public override void GetMad() {
Console.WriteLine("DUN DUN DUN DUN DUN");
public override void GetMad() {
Console.WriteLine("SCREEE");
public override void GetMad() {
Console.WriteLine("MRAOWWWR");
Bear barryTheBear = new Bear();
barryTheBear.latinName = "Ursidae";
barryTheBear.numberOfSalmonPerDay = 100;
cory.latinName = "Felis catus";
Harold.latinName = "Canis lupus familiaris";
Larry.latinName = "Panthera leo";
Platypus WussyPuss = new Platypus();
WussyPuss.latinName = "Ornithorhynchus anatinus";
Shark Mark = new Shark();
Mark.latinName = "Selachimorpha";
Turtle Murtle = new Turtle();
Murtle.latinName = "Testudines";
Jinx.latinName = "Felis lynx";
public static void Main4()
ElevenFiftyEmployee paul = new ElevenFiftyEmployee();
paul.Name = "Paul O'Connor";
paul.CommonWorkQuote = "Somebody's got a case of the Mondays";
paul.title = "Intructor";
Console.WriteLine("The Id: {0} for {1}. Has been working for {2} {3} years as an {4}", paul.Id, paul.Name, paul.years, paul.GetQuote(), paul.title);
class ElevenFiftyEmployee
private int _yearsExperience;
private string _jobTitle;
private string _employeeName;
private string _commonWorkQuote;
throw new Exception("The Employee Id is not valid");
if(string.IsNullOrEmpty(value))
throw new Exception("The Employee name is not valid");
this._employeeName = value;
return this._employeeName;
public void SetCommonWorkQuote(string quote)
this._commonWorkQuote = quote;
return this._commonWorkQuote;
public string CommonWorkQuote { get; set; }
throw new Exception("Work experience is low");
this._yearsExperience = value;
return this._yearsExperience;
if(string.IsNullOrEmpty(value))
throw new Exception ("Job title is invalid");
public static void Main5()
Console.WriteLine(" Object 1 ");
Console.WriteLine(" Object 2 ");
Music ledZeppelin = new Rock();
ledZeppelin.AnnounceGreatMusic();
Music JimmyCliff = new Reggae();
JimmyCliff.AnnounceGreatMusic();
public abstract class Music
public virtual void AnnounceGreatMusic()
Console.WriteLine("It's impossible to argue that the greatest music of all time comes from Michael Bolton.");
public void AnnounceGreatMusic(string name)
Console.WriteLine("Anything by {0} is the greatest music of all time", name);
public void AnnounceGreatMusic(string name, string album)
Console.WriteLine("{0} is the best in the world. Check out {1}. It's a great album.", name, album);
public class Rock : Music
public override void AnnounceGreatMusic()
Console.WriteLine("Led Zeppelin is the greatest rock band of all time");
public class Reggae : Music
public override void AnnounceGreatMusic()
Console.WriteLine("Jimmy Cliff is the best Reggae singer of all time");
Console.WriteLine(RankType.Two);
Cards hand = new Cards();
hand.GetCard(RankType.Lowace);
public void GetCard(RankType card){
Console.WriteLine("I was dealt: {0}", card);
struct AddressBookEntry {
public string AddressLine1;
public string AddressLine2;
public string GetAddress()
var result = String.Format("Address: {0}{4}\nCity: {1}\nState: {2}\nZIP: {3}",
String.IsNullOrWhiteSpace(this.AddressLine2) ?
"" : String.Format("\n{0}", this.AddressLine2)
var Paul = new AddressBookEntry();
Paul.AddressLine1 = "123 Coder Boulevard";
Paul.AddressLine2 = "Attn: Awesomeness";
var Gavin = new AddressBookEntry() {
AddressLine1 = "123 Please Fix My Computer Blvd.",
Console.WriteLine(Paul.AddressLine1);
Console.WriteLine("Gavin's address is {0}", Gavin.AddressLine1);
Console.WriteLine(Paul.GetAddress());
var addresses = new List<AddressBookEntry>();
addresses.Add(new AddressBookEntry() {
AddressLine1 = "1150 West 116th St",
Console.WriteLine(addresses.Count);
foreach (var address in addresses)
Console.WriteLine(address.GetAddress());
addresses.Add(new AddressBookEntry() {
AddressLine1= "1234 Somewhere Place",
Console.WriteLine(addresses.Count);
foreach (var address in addresses)
Console.WriteLine(address.GetAddress());
Person stephCurry = new Person("Stephan", "Curry");
Adult draymondGreen = new Adult("Draymond", "Green");
Adult klayThompson = new Adult("Klay", "Thompson", true);
public string FirstName { get; set; }
public string LastName { get; set; }
public Person(string firstName, string lastName)
this.FirstName = firstName;
this.LastName = lastName;
public bool IsAwesome { get; set;}
public Adult(string firstName, string lastName) : base (firstName, lastName)
public Adult(string firstName, string lastName, bool isAwesome) : base (firstName, lastName)
this.IsAwesome = isAwesome;