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
27 changes: 20 additions & 7 deletions HelloWorld/HelloWorld.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
using System;

namespace HelloWorld
public class Program
{
class Program
public static void Main()
{
static void Main(string[] args)
{
Console.WriteLine("Hello World!");
}
}
string name = "";
int age = 0;
int year = 0;


Console.WriteLine("Please enter your name: ");
name = Console.ReadLine();
Console.WriteLine("Please enter your age: ");
age = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Please enter the year: ");
year = Convert.ToInt32(Console.ReadLine());

Console.WriteLine("Hello! My name is {0} and I am {1} years old I was born in {2}.", name, age, year-age);
}


}


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"
}
]
}
36 changes: 31 additions & 5 deletions PigLatin/PigLatin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,46 @@

namespace PigLatin
{
class Program
public class Program
{
public static void Main()
{
// your code goes here

System.Console.WriteLine("Translate word: ");
string engWord = Console.ReadLine();
string PigLatin = TranslateWord(engWord);
System.Console.WriteLine(PigLatin);








// 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;

}
}
}
}
28 changes: 28 additions & 0 deletions StarWars/.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/StarWars.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 StarWars/.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}/StarWars.csproj"
],
"problemMatcher": "$msCompile"
}
]
}
147 changes: 147 additions & 0 deletions StarWars/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
using System;

public class Program
{
public static void Main()
{
Station rebelSpaceStation = new Station("RebelSpaceStation", 2, "Rebel");
Person leia = new Person("Leia", "Organa", "Rebel");
Person luke = new Person("Luke", "Skywalker", "Rebel");
Ship falcon = new Ship("Rebel", "Smuggling", 2);
Ship tie = new Ship("Tie", "Fighter", 1);
Station smallStation = new Station("Rebel", 2, "Rebel");
smallStation.ParkShip(tie, 0);
tie.addPerson(leia, 0);
Console.WriteLine(smallStation.Roster);

}
}

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 initialName)
{
Name = initialName;
}
public string Name { get; private set; }
public Ship(string alliance, string type, int size)
{
this.Type = type;
this.Alliance = alliance;
this.passengers = new Person[size];
}

public string Type
{
get;
set;
}

public string Alliance
{
get;
set;
}

public string Passengers
{
get
{
foreach (var person in passengers)
{
if (person != null)
{
Console.WriteLine(String.Format("{0}", person.FullName));
}
}

return "That's Everybody!";
}
}
public void addPerson(Person passengers, int spot)
{
this.passengers[spot] = passengers;
}


public void EnterShip(Person person, int seat)
{
this.passengers[seat] = person;
}

public void ExitShip(int seat)
{
this.passengers[seat] = null;
}
}

class Station
{
private Ship[] ships;
public string Name { get; private set; }
public int Size { get; private set; }
public string Alliance { get; private set; }

public Station(string initialName, int initialSize, string alliance)
{
this.Name = initialName;
this.ships = new Ship[initialSize];
this.Size = initialSize;
this.Alliance = alliance;
}

public void ParkShip(Ship ship, int spot)
{
ships[spot] = ship;
}
public void ExitStation(int spot)
{
this.ships[spot] = null;
}

public string Roster
{
get
{
for (int i = 0; i < ships.Length; i++)
{
if (ships[i] != null)
{
Console.WriteLine(String.Format("The {0} ship is in spot {1} and the people on that ship are:", ships[i].Type, i));
Console.WriteLine(ships[i].Passengers);
}
}
return "That's all!";

}
}
}
8 changes: 8 additions & 0 deletions StarWars/StarWars.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>
26 changes: 26 additions & 0 deletions TextBasedGame/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/bin/Debug/netcoreapp2.2/TextBasedGame.dll",
"args": [],
"cwd": "${workspaceFolder}",
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
15 changes: 15 additions & 0 deletions TextBasedGame/.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}/TextBasedGame.csproj"
],
"problemMatcher": "$msCompile"
}
]
}
Loading