From 22ccbc69489756f1a828cdaaa384170c89a54656 Mon Sep 17 00:00:00 2001 From: DeMarco Date: Sat, 6 Oct 2018 11:01:55 -0500 Subject: [PATCH 01/10] finished week1 practice --- Week1-Practice/Program.cs | 51 ++++++++++++++++++++++++++++ Week1-Practice/Week1-Practice.csproj | 9 +++++ 2 files changed, 60 insertions(+) create mode 100644 Week1-Practice/Program.cs create mode 100644 Week1-Practice/Week1-Practice.csproj 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 + + + From d8271b9287dcc7b28b64eb2e2553a3a1f71b1782 Mon Sep 17 00:00:00 2001 From: DeMarco Date: Sun, 7 Oct 2018 22:18:07 -0500 Subject: [PATCH 02/10] textgame file added --- TextGame/TextGame.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 TextGame/TextGame.cs diff --git a/TextGame/TextGame.cs b/TextGame/TextGame.cs new file mode 100644 index 00000000..cb26e2c1 --- /dev/null +++ b/TextGame/TextGame.cs @@ -0,0 +1,18 @@ +musing System; +using threading; + +namespace TextGame +{ + + class Program + { + + public void Main(string[] args) + { + Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + Console.WriteLine("Welcome to the cavern of secrets!"); + Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + + } + } +} \ No newline at end of file From e11262739c429c1abcd0b6091fac436f01ebbb42 Mon Sep 17 00:00:00 2001 From: DeMarco Date: Sun, 7 Oct 2018 22:22:14 -0500 Subject: [PATCH 03/10] file renamed --- TextGame/{TextGame.cs => Program.cs} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename TextGame/{TextGame.cs => Program.cs} (94%) diff --git a/TextGame/TextGame.cs b/TextGame/Program.cs similarity index 94% rename from TextGame/TextGame.cs rename to TextGame/Program.cs index cb26e2c1..2ad6914c 100644 --- a/TextGame/TextGame.cs +++ b/TextGame/Program.cs @@ -1,5 +1,5 @@ musing System; -using threading; +// using threading; namespace TextGame { From 2efd24f79bc6e2d9e43a8d53fcb47161e25369a9 Mon Sep 17 00:00:00 2001 From: DeMarco Date: Mon, 8 Oct 2018 00:01:06 -0500 Subject: [PATCH 04/10] 1st attempt text game --- TextGame/Program.cs | 58 +++++++++++++++++++++++++++++++++++++--- TextGame/textgame.csproj | 8 ++++++ 2 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 TextGame/textgame.csproj diff --git a/TextGame/Program.cs b/TextGame/Program.cs index 2ad6914c..f36f44f5 100644 --- a/TextGame/Program.cs +++ b/TextGame/Program.cs @@ -1,5 +1,5 @@ -musing System; -// using threading; +using System; +using System.Threading; namespace TextGame { @@ -7,12 +7,62 @@ namespace TextGame class Program { - public void Main(string[] args) + 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 random = new Random(); + // int fdmg1 = Random.Next(3, 10); + // int edmg1 = Random.Next(1, 5); + Console.WriteLine("you hit a"); + Console.WriteLine("the spider hits a"); + Thread.Sleep(2000); + } + } } -} \ No newline at end of file +} 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 + + + From ff1c62b4b12f48870fcd03309b0a8c72004e15db Mon Sep 17 00:00:00 2001 From: DeMarco Date: Tue, 9 Oct 2018 22:04:21 -0500 Subject: [PATCH 05/10] updated text game --- TextGame/Program.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/TextGame/Program.cs b/TextGame/Program.cs index f36f44f5..eb04b169 100644 --- a/TextGame/Program.cs +++ b/TextGame/Program.cs @@ -54,9 +54,10 @@ static void Main(string[] args) Console.WriteLine("IF THE SPIDER HITS HIGHER THAN YOU, YOU WILL DIE"); Console.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); Thread.Sleep(2000); - // Random random = new Random(); - // int fdmg1 = Random.Next(3, 10); - // int edmg1 = Random.Next(1, 5); + // 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); From 125a46f519042907761f446a302623905dc2c5fa Mon Sep 17 00:00:00 2001 From: DeMarco Date: Mon, 22 Oct 2018 20:08:08 -0500 Subject: [PATCH 06/10] new folder --- week4-practice/Program.cs | 91 ++++++++++++++++++++++++++++ week4-practice/week4-practice.csproj | 9 +++ 2 files changed, 100 insertions(+) create mode 100644 week4-practice/Program.cs create mode 100644 week4-practice/week4-practice.csproj diff --git a/week4-practice/Program.cs b/week4-practice/Program.cs new file mode 100644 index 00000000..f03fd13c --- /dev/null +++ b/week4-practice/Program.cs @@ -0,0 +1,91 @@ +using System; + +namespace RockPaperScissors2 +{ + class Program + { + public static void Main() + { + try { + + } + Console.WriteLine("Enter hand 1:"); + string hand1 = Console.ReadLine().ToLower(); + Console.WriteLine("Enter hand 2:"); + string hand2 = Console.ReadLine().ToLower(); + Console.WriteLine(CompareHands(hand1, hand2)); + + // leave this command at the end so your program does not close automatically + Console.ReadLine(); + + + } + /// implement exception + /// catch exception + // if user enter incorrect imput + + public static string CompareHands(string hand1, string hand2) + { + // Your code here + if (hand1 == "rock" && hand2 == "rock") + { + Console.WriteLine("Tie"); + } else if (hand1 == "rock" && hand2 == "scissors") + { + Console.WriteLine("hand1 wins!"); + } else if (hand1 == "rock" && hand2 == "paper") + { + Console.WriteLine("hand2 wins!"); + } else if (hand1 == "scissors" && hand2 == "rock") + { + Console.WriteLine("hand2 wins"); + } else if (hand1 == "scissors" && hand2 == "paper") + { + Console.WriteLine("hand1 wins"); + } else if (hand1 == "scissors" && hand2 == "scissors") + { + Console.WriteLine("Tie"); + } else if (hand1 == "paper" && hand2 == "paper") + { + Console.WriteLine("Tie"); + } else if (hand1 == "paper" && hand2 == "scissors") + { + Console.WriteLine("hand2 wins"); + } else if (hand1 == "paper" && hand2 == "rock") + { + Console.WriteLine("hand1 wins"); + } else + { + Console.WriteLine("try again"); + } + + + return hand1 + ' ' + hand2; + } + // public static bool test() + // { + // return 0; + + // CompareHands("Paper", "Paper") == 0 && + // CompareHands("Paper", "Rock") == 1 && + // CompareHands("Paper", "Scissors") == 2 && + // CompareHands("Rock", "Paper") == 2 && + // CompareHands("Rock", "Rock") == 0 && + // CompareHands("Rock", "Scissors") == 1 && + // CompareHands("Scissors", "Paper") == 1 && + // CompareHands("Scissors", "Scissors") == 0 && + // CompareHands("Scissors", "Rock") == 2; + + // } +// } +// } + + +// try{ +// double answer1 = Divide(17.0, 1.0); +// Console.WriteLine(answer1); +// } catch (Exception e) { +// Console.WriteLine("There was a error with the function"); +// } finally { +// Console.WriteLine ("Thanks for playing"); +} \ No newline at end of file diff --git a/week4-practice/week4-practice.csproj b/week4-practice/week4-practice.csproj new file mode 100644 index 00000000..7eae0601 --- /dev/null +++ b/week4-practice/week4-practice.csproj @@ -0,0 +1,9 @@ + + + + Exe + netcoreapp2.1 + week4_practice + + + From 637fd46b53ab91c74415573a119531eb66a66137 Mon Sep 17 00:00:00 2001 From: DeMarco Date: Wed, 24 Oct 2018 19:53:58 -0500 Subject: [PATCH 07/10] class notes --- week4-practice/week4-practice2.cs | 47 +++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 week4-practice/week4-practice2.cs diff --git a/week4-practice/week4-practice2.cs b/week4-practice/week4-practice2.cs new file mode 100644 index 00000000..72670208 --- /dev/null +++ b/week4-practice/week4-practice2.cs @@ -0,0 +1,47 @@ +using System; +using System.Threading; +using System.Collections.Generic; + +namespace Week4practice2 +{ + class Program + { + static void Main() + { + list personName = new list("John", "Mike", "Sam"); + + personName.Add("John"); + personName.Add("Mike"); + personName.Add("Sam"); + + foreach (String name in personName) + { + Console.WriteLine(personName); + } + names.RemoveAt(2); + + foreach (String name in personName) + { + Console.WriteLine(personName); + } + + } + } +} + +//peek(); +//pop(); +//push(); push to stack +//count(); +//Deepth first before breath first + +//Stack var*stackname = new Stack(); +var.Push("John"); +var.Push("Sam"); +var.Push("Paul"); + +while(name.Count > 0) +{ + String currentName = names.Pop(); + Console.WriteLine("Processing" +currentName); +} From 1ed7af720c3c4def9e8f8650d09dcd9f05a2a685 Mon Sep 17 00:00:00 2001 From: DeMarco Date: Wed, 24 Oct 2018 19:55:42 -0500 Subject: [PATCH 08/10] class notes --- week4-practice/week4-practice2.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/week4-practice/week4-practice2.cs b/week4-practice/week4-practice2.cs index 72670208..71d3c8d6 100644 --- a/week4-practice/week4-practice2.cs +++ b/week4-practice/week4-practice2.cs @@ -36,12 +36,12 @@ static void Main() //Deepth first before breath first //Stack var*stackname = new Stack(); -var.Push("John"); -var.Push("Sam"); -var.Push("Paul"); - -while(name.Count > 0) -{ - String currentName = names.Pop(); - Console.WriteLine("Processing" +currentName); -} +// var.Push("John"); +// var.Push("Sam"); +// var.Push("Paul"); + +// while(name.Count > 0) +// { +// String currentName = names.Pop(); +// Console.WriteLine("Processing" +currentName); +// } From b53e269ab6e87a770b40a140c69dcdcfdc3cd3ac Mon Sep 17 00:00:00 2001 From: DeMarco Date: Sat, 27 Oct 2018 21:17:44 -0500 Subject: [PATCH 09/10] inital Checkpoint1 --- Checkpoint1/Checkpoint1.cs | 75 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 72 insertions(+), 3 deletions(-) diff --git a/Checkpoint1/Checkpoint1.cs b/Checkpoint1/Checkpoint1.cs index b7ed8611..6ad3c322 100644 --- a/Checkpoint1/Checkpoint1.cs +++ b/Checkpoint1/Checkpoint1.cs @@ -1,12 +1,81 @@ using System; +using System.Threading; namespace Checkpoint1 { class Program { - static void Main(string[] args) + static void Main() { - Console.WriteLine("Hello World!"); + int i; + for (i = 1; i <= 100; i++) + { + if (i % 3 == 0) + { + Console.WriteLine(i); + + } + } + Number(); + Thread.Sleep(2000); + Factorial(); + Thread.Sleep(2000); + + + + + } + static void Number() + { + int sum = 0; + while (true) + { + Console.Write("Enter a number: or ok to exit : "); + String input = Console.ReadLine(); + if (input == "ok" || input.ToLower() == "ok") break; + if (string.IsNullOrWhiteSpace(input)) + continue; + sum += Convert.ToInt32(input); + Console.WriteLine(sum); + } + Console.WriteLine(sum); } + + static void Factorial() + { + Console.WriteLine("Please enter your number: "); + int input = int.Parse(Console.ReadLine()); + + int fact = 1; + for (int i = 1; i <= input; i++) + { + fact *= i; + } + + Console.WriteLine("The Factorial is " + fact); + } + + static void PickNum() + { + + while(true) + { + Console.WriteLine("Pick a random number between 1-10"); + int num = int.Parse(Console.ReadLine()); + Random userNum = new Random.Next(1,11); + + + if (userNum == num) + { + + } + } + + } + + + + } -} + +} \ No newline at end of file From 5b13a12d99f3fcf1d649fb56db480d8310f2dc54 Mon Sep 17 00:00:00 2001 From: DeMarco Date: Mon, 29 Oct 2018 05:58:08 -0500 Subject: [PATCH 10/10] Final Checkpoint1 --- Checkpoint1/Checkpoint1.cs | 45 +++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/Checkpoint1/Checkpoint1.cs b/Checkpoint1/Checkpoint1.cs index 6ad3c322..7cd9112f 100644 --- a/Checkpoint1/Checkpoint1.cs +++ b/Checkpoint1/Checkpoint1.cs @@ -8,6 +8,7 @@ class Program static void Main() { int i; + //declared the var i to be used in my for loop for (i = 1; i <= 100; i++) { if (i % 3 == 0) @@ -18,8 +19,12 @@ static void Main() } Number(); Thread.Sleep(2000); + //wanted the next methods to display on the console using a delay Factorial(); Thread.Sleep(2000); + PickNum(); + Thread.Sleep(2000); + Max(); @@ -34,6 +39,7 @@ static void Number() String input = Console.ReadLine(); if (input == "ok" || input.ToLower() == "ok") break; if (string.IsNullOrWhiteSpace(input)) + //i found the class IsNullorWhiteSpace online and thought I should try it out continue; sum += Convert.ToInt32(input); Console.WriteLine(sum); @@ -57,22 +63,51 @@ static void Factorial() static void PickNum() { + int i; - while(true) + for (i = 1; i <=4; i++) { Console.WriteLine("Pick a random number between 1-10"); - int num = int.Parse(Console.ReadLine()); - Random userNum = new Random.Next(1,11); - + int number = int.Parse(Console.ReadLine()); + Random rnd = new Random(); + int userNum = rnd.Next(1,11); - if (userNum == num) + if (userNum == number) { + Console.WriteLine("You Won"); + break; + } else { + Console.WriteLine("You Lost"); + Console.WriteLine(); } + } + } + static void Max() +{ + + Console.Write("Please enter a series of numbers separated by a comma: "); + string userInput = Console.ReadLine(); + + string[] numbers = userInput.Split(','); + int max = 0; + int sum = 0; + for (int i = 0; i < numbers.GetLength(0); i++) + { + if (Convert.ToInt32(numbers[i]) > max) + { + max = Convert.ToInt32(numbers[i]); + // sum = Convert.ToInt32( sum + numbers[i]); + } + } + Console.WriteLine(max + " is the max "); + // Console.WriteLine(sum + " is the total of all the numbers "); + Console.ReadLine(); + }