diff --git a/Inheritance/Inheritance.csproj b/Inheritance/Inheritance.csproj
new file mode 100644
index 00000000..23df6047
--- /dev/null
+++ b/Inheritance/Inheritance.csproj
@@ -0,0 +1,8 @@
+
+
+
+ Exe
+ netcoreapp2.1
+
+
+
diff --git a/Inheritance/Program.cs b/Inheritance/Program.cs
new file mode 100644
index 00000000..5815af61
--- /dev/null
+++ b/Inheritance/Program.cs
@@ -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;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Linq/Linq.cs b/Linq/Linq.cs
index 6cabb44e..5cb21bb0 100644
--- a/Linq/Linq.cs
+++ b/Linq/Linq.cs
@@ -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);
+ }
+
}
}
}
diff --git a/TowersOfHanoi/TowersOfHanoi.cs b/TowersOfHanoi/TowersOfHanoi.cs
index 10475b4a..bfe532c0 100644
--- a/TowersOfHanoi/TowersOfHanoi.cs
+++ b/TowersOfHanoi/TowersOfHanoi.cs
@@ -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 blocks = new Stack();
+
+
+ }
+ public class Game
+ {
+ // Console.WriteLine("Which one?");
+ public Dictionary towers = new Dictionary();
+
+ 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;
+ }
+ }
+
+ }
+
}
diff --git a/WebServer/WebServer.cs b/WebServer/WebServer.cs
deleted file mode 100644
index 0ee8ec66..00000000
--- a/WebServer/WebServer.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-using System;
-using System.Threading;
-using SimpleHttp;
-using System.IO;
-using System.Linq;
-using Microsoft.Data.Sqlite;
-using System.Collections.Generic;
-
-namespace WebServer
-{
- class Program
- {
- static SqliteConnectionStringBuilder connectionStringBuilder = new SqliteConnectionStringBuilder();
-
- static void Main()
- {
- connectionStringBuilder.DataSource = "./database.db";
-
- Route.Add("/items", (request, response, args) => {
- response.AsText(getItems());
- });
-
- Route.Add("/items", (request, response, args) => {
- RunQuery($@"
- INSERT into items (name, price, container_id)
- VALUES ('milk', '2.99', 1);
- ");
- response.AsText(getItems());
- }, "POST");
-
- //run the server
- int port = 8000;
- Console.WriteLine($"Running Server On http://127.0.0.1:{port}");
- HttpServer.ListenAsync(port, CancellationToken.None, Route.OnHttpRequestAsync).Wait();
- }
-
- static string getItems()
- {
- List> results = RunQuery(@"
- SELECT *
- FROM items;
- ");
- string stringResults = PrintResults(results);
- stringResults += @"
-
-
- ";
- return stringResults;
- }
-
- static List> RunQuery(string query)
- {
- using (var connection = new SqliteConnection(connectionStringBuilder.ConnectionString))
- {
- connection.Open();
- var selectCmd = connection.CreateCommand();
- selectCmd.CommandText = query;
- SqliteDataReader reader = selectCmd.ExecuteReader();
- List> results = getResults(reader);
- reader.Close();
- connection.Close();
- return results;
- }
- }
-
- static List> getResults(SqliteDataReader reader)
- {
- List> results = new List>();
- int row = 0;
- while (reader.Read()){
- results.Add(new Dictionary());
- for (var column = 0; column < reader.FieldCount; column++)
- {
- results[row].Add(reader.GetName(column), reader.GetString(column));
- }
- row++;
- }
- return results;
- }
-
- static string PrintResults(List> results)
- {
- string resultsString = "";
- foreach (var result in results)
- {
- System.Collections.Generic.IEnumerable lines = result.Select(kvp => kvp.Key + ": " + kvp.Value);
- resultsString += String.Join(Environment.NewLine, lines);
- }
- return resultsString;
- }
- }
-}
diff --git a/WebServer/WebServer.csproj b/WebServer/WebServer.csproj
deleted file mode 100644
index 4365eb1b..00000000
--- a/WebServer/WebServer.csproj
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
- Exe
- netcoreapp2.0
-
-
-
-
-
-
-
-
diff --git a/WebServer/database.db b/WebServer/database.db
deleted file mode 100644
index 2d22309b..00000000
Binary files a/WebServer/database.db and /dev/null differ