Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Inheritance/Inheritance.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

</Project>
81 changes: 81 additions & 0 deletions Inheritance/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
using System;
namespace week6_1
{
class Manufacture
{
public static void Main(string[] args)
{
Car bmw = new Car(2,"BMW");
Car audi = new Car(2,"Audi");

Truck ford = new Truck(4,"Ford");
Truck crysler = new Truck(4,"Crysler");
Console.WriteLine(string.Format("The manufacture is {1} and the car has {0} spots available for passengers.",bmw.spots, bmw.Type));
Console.WriteLine(string.Format("The manufacture is {1} and the car has {0} spots available for passengers.",audi.spots, audi.Type));
Console.WriteLine(string.Format("The manufacture is {1} and the truck has {0} spots available for passengers.",ford.Spots, ford.Type));
Console.WriteLine(string.Format("The manufacture is {1} and the truck has {0} spots available for passengers.",crysler.Spots,crysler.Type));

}
}
public interface IcheckCar
{
int getAvaiableSeat();
string getVehicle();
}
class Car : IcheckCar
{
public int Spots;
public string Type;
public Car(int spots,string type)
{
this.spots = spots;
this.Type = type;
}
public int spots
{
get;
set;
}
public string type
{
get;
set;
}
int IcheckCar.getAvaiableSeat()
{
return spots;
}
string IcheckCar.getVehicle()
{
return type;
}
}
class Truck : IcheckCar
{
public int Spots;
public string Type;
public Truck(int spots, string type)
{
this.Spots = spots;
this.Type = type;
}
public int spots
{
get;
set;
}
public string type
{
get;
set;
}
int IcheckCar.getAvaiableSeat()
{
return spots;
}
string IcheckCar.getVehicle()
{
return type;
}
}
}
13 changes: 12 additions & 1 deletion Linq/Linq.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,18 @@ class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
int[] numbers = new int[20];

for (int i = 0; i < numbers; i++; )
}
{
numbers[i] = randomGenerator.Next(0, 1000);
}
foreach (int n in numbers)
{
Console.WriteLine(n);
}

}
}
}
121 changes: 119 additions & 2 deletions TowersOfHanoi/TowersOfHanoi.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,129 @@
using System;
using System.Collections;
using System.Collections.Generic;

namespace TowersOfHanoi
{
class Program
{
static void Main(string[] args)
public static void Main(string[] args)
{
Console.WriteLine("Hello World!");
Game game = new Game();
game.CheckForWin();
}

}
public class Block
{
public int Weight {get; private set;}

public Block(int initalWeight)
{
this.Weight = initalWeight;

}
}
public class Tower
{
public Stack<Block> blocks = new Stack<Block>();


}
public class Game
{
// Console.WriteLine("Which one?");
public Dictionary<string, Tower> towers = new Dictionary<string, Tower>();

public Game()
{
towers.Add("A", new Tower());
towers.Add("B", new Tower());
towers.Add("C", new Tower());


Block block1 = new Block(10);
Block block2 = new Block(20);
Block block3 = new Block(30);

towers["A"].blocks.Push(block3);
towers["A"].blocks.Push(block2);
towers["A"].blocks.Push(block1);

while (CheckForWin())
{

Console.WriteLine(printBoard());

}

// Console.WriteLine("How many blocks would you like?");
// var NumOfBLocks = Console.ReadLine();
// Console.WriteLine("What tower do you pick?");
// Console.ReadLine();


}

public string printBoard()
{
string board = "";
foreach (var towerKey in towers.Keys)
{
foreach (Block block in towers[towerKey].blocks)
{

board += " Tower :" + towerKey + " Weight: " + block.Weight;



}
}
return board;
}
public void MovePiece(string popOff, string pushOn)
{
Block block = towers[popOff].blocks.Pop();
towers[pushOn].blocks.Push(block);
printBoard();

}
public bool isLegal(string popOff, string pushOn)
{
if (towers[popOff].blocks.Count == 0)
{
return false;
}
if (towers[pushOn].blocks.Count == 0)
{
return true;
}
Block popOffBlock = towers[popOff].blocks.Peek();
Block pushOnBlock = towers[pushOn].blocks.Peek();

if (popOffBlock.Weight > pushOnBlock.Weight)
{
return false;

}
else
{
return true;
}
}
public bool CheckForWin()
{
if (towers["B"].blocks.Count == 4 || towers["C"].blocks.Count == 4)
{
Console.WriteLine("You Won!");
return true;

}
else
{
return false;
}
}

}

}
108 changes: 0 additions & 108 deletions WebServer/WebServer.cs

This file was deleted.

13 changes: 0 additions & 13 deletions WebServer/WebServer.csproj

This file was deleted.

Binary file removed WebServer/database.db
Binary file not shown.