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
28 changes: 28 additions & 0 deletions Candles/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/Candles.dll",
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
,]
}
15 changes: 15 additions & 0 deletions Candles/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/Candles.csproj"
],
"problemMatcher": "$msCompile"
}
]
}
8 changes: 8 additions & 0 deletions Candles/Candles.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.2</TargetFramework>
</PropertyGroup>

</Project>
45 changes: 45 additions & 0 deletions Candles/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
using System;

namespace Candles
{
class Program
{
static void Main(string[] args)
{
int[] candles = new int[] { 6, 1, 8, 4, 9, 2 };
int length = candles.Length;
int count = BirthdayCakeCounter(candles.Length, candles);
System.Console.WriteLine($"Can blow out {count} candles");

}

public static int BirthdayCakeCounter(int length, int[] candles)
{
int tallest = 0;
int count = 0;

foreach (var candle in candles)
{
if (candle > tallest)
{
tallest = candle;
count = 0;
}
if (candle == tallest)
{
return count++;
}
}
return count;









}
}
}
28 changes: 28 additions & 0 deletions FizzBuzz/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.0/FizzBuzz.dll",
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
,]
}
15 changes: 15 additions & 0 deletions FizzBuzz/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/FizzBuzz.csproj"
],
"problemMatcher": "$msCompile"
}
]
}
25 changes: 24 additions & 1 deletion FizzBuzz/FizzBuzz.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,30 @@ class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
for (int i = 0; i <= 50; i++)
{
if (i % 3 == 0 && i % 5 == 0)
{
System.Console.WriteLine("FizzBuzz!");
}
else if (i % 3 == 0)
{
System.Console.WriteLine("Fizz");
}

else if (i % 5 == 0)
{
System.Console.WriteLine("Buzz");
}

else
{
Console.WriteLine(i);
}


}

}
}
}
28 changes: 28 additions & 0 deletions PigLatin/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.0/PigLatin.dll",
"args": [],
"cwd": "${workspaceFolder}",
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
,]
}
15 changes: 15 additions & 0 deletions PigLatin/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/PigLatin.csproj"
],
"problemMatcher": "$msCompile"
}
]
}
38 changes: 26 additions & 12 deletions PigLatin/PigLatin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,41 @@ class Program
{
public static void Main()
{
// your code goes here
string alphabet = "abcdefghijklmnopqrstuvwxyz";
string firstThird = alphabet.Substring(0, 8);
string secondThird = alphabet.Substring(8, 8);
string thirdThird = alphabet.Substring(17);
System.Console.WriteLine("Translate word: ");
string engWord = Console.ReadLine();
string PigLatin = TranslateWord(engWord);
System.Console.WriteLine(PigLatin);






Console.WriteLine("First Third: " + firstThird);
Console.WriteLine("Second Third: " + secondThird);
Console.WriteLine("Third Third: " + thirdThird);




// leave this command at the end so your program does not close automatically
Console.ReadLine();
}

public static string TranslateWord(string word)
{
// your code goes here


int firstVowelIndex = word.IndexOfAny(new char[] { 'A', 'E', 'I', 'O', 'U', 'a', 'e', 'i', 'o', 'u' });
if (firstVowelIndex == 0)
{
return word + "yay";
}
else if (firstVowelIndex != 0)
{
string firstLetter = word.Substring(0, 1);
string restWord = word.Substring(1);
// your code goes here
return restWord + firstLetter + "ay";
}

return word;

}
}
}
Loading