diff --git a/CarGarage/CarGarage.csproj b/CarGarage/CarGarage.csproj new file mode 100644 index 00000000..23df6047 --- /dev/null +++ b/CarGarage/CarGarage.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.1 + + + diff --git a/CarGarage/Program.cs b/CarGarage/Program.cs new file mode 100644 index 00000000..872acd17 --- /dev/null +++ b/CarGarage/Program.cs @@ -0,0 +1,143 @@ +using System; +using System.Collections.Generic; + +public class Program +{ + public static void Main() + { + Car blueCar = new Car("blue"); + Car redCar = new Car("red"); + Car greenCar = new Car("green"); + Car orangeCar = new Car("orange"); + Garage smallGarage = new Garage(4); + + Person person1 = new Person("James", "Smith"); + Person person2 = new Person("Jane", "Ann"); + Person person3 = new Person("Robert", "Class"); + Person person4 = new Person("Lisa", "George"); + + blueCar.addPerson(person1); + orangeCar.addPerson(person2); + + + smallGarage.ParkCar(blueCar, 0); + smallGarage.ParkCar(orangeCar,1); + smallGarage.ParkCar(redCar,2); + smallGarage.ParkCar(greenCar,3); + + + for ( int i =0; i < 1; i++){ + try + { + Car car = getCar(smallGarage); + + Console.WriteLine("Enter your first name:"); + string firstname = Console.ReadLine(); + Console.WriteLine("Enter your last name:"); + string lastName = Console.ReadLine(); + Person person = new Person(firstname,lastName); + car.addPerson(person); + + } + catch + { + Console.WriteLine("No car found"); + } + } + + Console.WriteLine(smallGarage.Cars); + } + public static string getUserCar() + { + Console.WriteLine("What car would you like?"); + string carChoice = Console.ReadLine().ToLower(); + return carChoice; + + } + public static Car getCar(Garage myCars) + { + string userCar = getUserCar(); + foreach (Car car in myCars.cars) + { + if (car.Color == userCar) + { + return car; + } + } + return null; + + } + +} +public class Car +{ + List people; + + public Car(string initialColor) + { + people = new List(); + Color = initialColor; + + + } + public void addPerson(Person person) + { + people.Add(person); + + } + public void getPeople() + { + foreach (Person p in people) + { + Console.WriteLine("{0} " + "{1} ", p.firstName, p.lastName); + } + } + + public string Color { get; private set; } +} + +public class Garage +{ + public Car[] cars { get; private set; } + + public Garage(int initialSize) + { + Size = initialSize; + this.cars = new Car[initialSize]; + } + + public int Size { get; private set; } + + public void ParkCar(Car car, int spot) + { + cars[spot] = car; + } + + public string Cars + { + get + { + for (int i = 0; i < cars.Length; i++) + { + if (cars[i] != null) + { + Console.WriteLine(String.Format("The {0} car is in spot {1}.", cars[i].Color, i)); + cars[i].getPeople(); + } + } + return "That's all!"; + } + } +} +public class Person +{ + + public string firstName { get; private set; } + public string lastName { get; private set; } + public Person(string firstName, string lastName) + { + this.firstName = firstName; + this.lastName = lastName; + } + +} diff --git a/FizzBuzz/FizzBuzz.cs b/FizzBuzz/FizzBuzz.cs index 9246f703..b3e5bff9 100644 --- a/FizzBuzz/FizzBuzz.cs +++ b/FizzBuzz/FizzBuzz.cs @@ -6,7 +6,24 @@ class Program { static void Main(string[] args) { - Console.WriteLine("Hello World!"); + for ( int i = 1; i <= 100; i++ ) + { + if (i % 3 == 0 & i % 5 == 0) + { + Console.WriteLine("FizzBuzz"); + } else if (i % 5 == 0) + { + Console.WriteLine("Buzz"); + } + else if (i % 3 == 0) + { + Console.WriteLine("Fizz"); + } else{ + Console.WriteLine(i); + } + } + + } } } -} + diff --git a/StarWars/Program.cs b/StarWars/Program.cs new file mode 100644 index 00000000..6ff12e47 --- /dev/null +++ b/StarWars/Program.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections.Generic; + +public class Program +{ + public static void Main() + { + Person leia = new Person("Leia", "Organa", "Rebel"); + Person darth = new Person("Darth", "Vader", "Imperial"); + Person luke = new Person("Luke", "Skywalker", "Rebel"); + Person han = new Person("Han", "Solo", "Rebel"); + Person palp = new Person("Emporer", "Palpatine", "Imperial"); + Ship x = new Ship("xwing", "Rebel", "fighter", 2); + Ship falcon = new Ship("MilFal", "Rebel", "Smuggling", 2); + Ship tie = new Ship("TieFie", "Tie", "Fighter", 1); + Station station1 = new Station("Rebel Space Station", "Rebel", 3); + Station station2 = new Station("Death Star", "Imperial", 3); + x.EnterShip(luke, 0); + x.EnterShip(han, 1); + station1.DockShip(x, 1); + PrintRoster(station1); + } + private static void PrintRoster(Station station) + { + + foreach (KeyValuePair ships in station.Docked) + { + Console.WriteLine("Ship {0} contains:", ships.Value.Name); + Console.WriteLine("{0}", ships.Value.Passengers); + } + } +} +class Person +{ + private string firstName; + private string lastName; + private string alliance; + public Person(string firstName, string lastName, string alliance) + { + this.firstName = firstName; + this.lastName = lastName; + this.alliance = alliance; + } + public string FullName + { + get + { + return this.firstName + " " + this.lastName; + } + set + { + string[] names = value.Split(' '); + this.firstName = names[0]; + this.lastName = names[1]; + } + } +} +class Ship +{ + private Person[] passengers; + public Ship(string name, string alliance, string type, int size) + { + this.Name = name; + this.Type = type; + this.Alliance = alliance; + this.passengers = new Person[size]; + } + public string Name + { + get; + set; + } + public string Type + { + get; + set; + } + public string Alliance + { + get; + set; + } + public string Passengers + { + get + { + foreach (var person in passengers) + { + Console.WriteLine(String.Format("{0}", person.FullName)); + } + return "That's Everybody!"; + } + } + public void EnterShip(Person person, int seat) + { + this.passengers[seat] = person; + } + public void ExitShip(int seat) + { + this.passengers[seat] = null; + } +} +class Station +{ + public string Name { get; set; } + public string Alliance { get; set; } + public int Size { get; set; } + public Dictionary Docked = new Dictionary(); + public Station(string name, string alliance, int size) + { + this.Name = name; + this.Alliance = alliance; + } + public void DockShip(Ship ship, int port) + { + Docked.Add(port, ship); + } + public void UnDockShip(Ship ship, int port) + { + Docked.Remove(port); + } +} \ No newline at end of file diff --git a/StarWars/StarWars.csproj b/StarWars/StarWars.csproj new file mode 100644 index 00000000..23df6047 --- /dev/null +++ b/StarWars/StarWars.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.1 + + + diff --git a/TextGame/Program.cs b/TextGame/Program.cs index db251101..ea418a60 100644 --- a/TextGame/Program.cs +++ b/TextGame/Program.cs @@ -1,4 +1,71 @@ using System; +<<<<<<< HEAD +using System.Threading; + +namespace TextGame +{ + + class Program + { + + static void Main(string[] args) + { + Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + Console.WriteLine("Welcome to the cavern of secrets!"); + Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + Thread.Sleep(1000); + Console.WriteLine("You enter a dark cavern out of curiosity. It is dark and you can only make out a small stick on the floor."); + Console.WriteLine("Do you take it? [y/n]: "); + string ch1 = Console.ReadLine(); + string ch2 = Console.ReadLine(); + string ch3 = Console.ReadLine(); + + int stick = 0; + if (ch1 == "y") + { + Console.WriteLine("You have taken the stick!"); + Thread.Sleep(2000); + stick = 1; + } + else + { + Console.WriteLine("You did not take the stick"); + stick = 0; + Console.WriteLine("As you proceed further into the cave, you see a small glowing object"); + + } + if (ch2 == "y") + { + Console.WriteLine("You approach the object..."); + Thread.Sleep(2000); + Console.WriteLine("As you draw closer, you begin to make out the object as an eye!"); + Thread.Sleep(2000); + Console.WriteLine("The eye belongs to a giant spider!"); + Console.WriteLine("Do you try to fight it? [Y/N]"); + } + if (ch3 == "y") + { + if (stick == 1) + Console.WriteLine("You only have a stick to fight with!"); + Console.WriteLine("You quickly jab the spider in it's eye and gain an advantage"); + Thread.Sleep(2000); + Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + Console.WriteLine(" Fighting... "); + Console.WriteLine(" YOU MUST HIT ABOVE A 5 TO KILL THE SPIDER "); + Console.WriteLine("IF THE SPIDER HITS HIGHER THAN YOU, YOU WILL DIE"); + Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + Thread.Sleep(2000); + // Random randomNub = new Random(); + // int fdmg1 = Random.Next(3, 11); + // int edmg1 = Random.Next(1, 6); + //the random number gen will not display properly- im getting an error message + Console.WriteLine("you hit a"); + Console.WriteLine("the spider hits a"); + Thread.Sleep(2000); + } + + +======= namespace TextGame { @@ -7,6 +74,7 @@ class Program static void Main(string[] args) { Console.WriteLine("Hello World!"); +>>>>>>> d2fd3277576d0b313a2a44f3bca7c718c5dd1178 } } } diff --git a/TextGame/textgame.csproj b/TextGame/textgame.csproj new file mode 100644 index 00000000..23df6047 --- /dev/null +++ b/TextGame/textgame.csproj @@ -0,0 +1,8 @@ + + + + Exe + netcoreapp2.1 + + + diff --git a/Week1-Practice/Program.cs b/Week1-Practice/Program.cs new file mode 100644 index 00000000..f5903523 --- /dev/null +++ b/Week1-Practice/Program.cs @@ -0,0 +1,51 @@ +using System; + +namespace Week1_Practice +{ + class Program + { + static void Main(string[] args) + { + int input1 = 0; + int input2 = 0; + + Console.WriteLine("Give me a number between 0 and 100:"); + input1 = Convert.ToInt32(Console.ReadLine()); + Console.WriteLine("Give me another number between 0 and 100:"); + input2 = Convert.ToInt32(Console.ReadLine()); + + Console.WriteLine(input1 + input2); + + int yardLength = 0; + int inchLength = 0; + Console.WriteLine("Give me a number of yards?"); + yardLength = Convert.ToInt32(Console.ReadLine()); + inchLength = (yardLength * 36); + + Console.WriteLine("You have {0} inches!", inchLength); + + bool people = true; + bool f = false; + decimal numb = 0.0M; + + + string firstName = "DeMarco"; + string lastName = "Spears"; + int age = 27; + string job = "Client Support Agent"; + string favoriteBand = "Beetles"; + string favoriteSportsTeam = "Golden State Warriors"; + + + Console.WriteLine("Give me a decimal number?"); + numb = Convert.ToDecimal(Console.ReadLine()); + Console.WriteLine(numb * numb); + Console.WriteLine("I love sports my favorite team is the {0}", favoriteSportsTeam); + Console.WriteLine("My birthday is on the forth of July, I'm {0} years old!", age); + Console.WriteLine("My favorite band of all time is the {0}!", favoriteBand); + Console.WriteLine("I work at Dell as a {0}!", job); + + } + } + +} diff --git a/Week1-Practice/Week1-Practice.csproj b/Week1-Practice/Week1-Practice.csproj new file mode 100644 index 00000000..b8c2678e --- /dev/null +++ b/Week1-Practice/Week1-Practice.csproj @@ -0,0 +1,9 @@ + + + + Exe + netcoreapp2.1 + Week1_Practice + + +