Lister er fucked
This commit is contained in:
parent
03716695f9
commit
12c164c6b3
16
Emne 3/Constructors/Constructors.sln
Normal file
16
Emne 3/Constructors/Constructors.sln
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Constructors", "Constructors\Constructors.csproj", "{E8126D7B-F007-4E3D-8A8C-473B25A5CFE6}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{E8126D7B-F007-4E3D-8A8C-473B25A5CFE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{E8126D7B-F007-4E3D-8A8C-473B25A5CFE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{E8126D7B-F007-4E3D-8A8C-473B25A5CFE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{E8126D7B-F007-4E3D-8A8C-473B25A5CFE6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
22
Emne 3/Constructors/Constructors/Program.cs
Normal file
22
Emne 3/Constructors/Constructors/Program.cs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
namespace Constructors
|
||||||
|
{
|
||||||
|
public class Person
|
||||||
|
{
|
||||||
|
public String Name { get; set; }
|
||||||
|
public int Age { get; set; }
|
||||||
|
|
||||||
|
public Person(String name, Int32 age)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Age = age;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var person1 = new Person("John", 19);
|
||||||
|
Console.WriteLine($"Navn: {person1.Name}, Alder: {person1.Age}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
16
Emne 3/ObjekterIListe/ObjekterIListe.sln
Normal file
16
Emne 3/ObjekterIListe/ObjekterIListe.sln
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ObjekterIListe", "ObjekterIListe\ObjekterIListe.csproj", "{F05F887B-9700-40F0-BB06-7B90A67E1057}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{F05F887B-9700-40F0-BB06-7B90A67E1057}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{F05F887B-9700-40F0-BB06-7B90A67E1057}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{F05F887B-9700-40F0-BB06-7B90A67E1057}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{F05F887B-9700-40F0-BB06-7B90A67E1057}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
10
Emne 3/ObjekterIListe/ObjekterIListe/ObjekterIListe.csproj
Normal file
10
Emne 3/ObjekterIListe/ObjekterIListe/ObjekterIListe.csproj
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
16
Emne 3/ObjekterIListe/ObjekterIListe/Person.cs
Normal file
16
Emne 3/ObjekterIListe/ObjekterIListe/Person.cs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
namespace ObjekterIListe;
|
||||||
|
|
||||||
|
public class Person
|
||||||
|
{
|
||||||
|
public string FirstName { get; set; }
|
||||||
|
public string LastName { get; set; }
|
||||||
|
public int Age { get; set; }
|
||||||
|
|
||||||
|
// Constructor
|
||||||
|
public Person(string firstName, string lastName, int Age)
|
||||||
|
{
|
||||||
|
firstName = firstName;
|
||||||
|
lastName = lastName;
|
||||||
|
Age = Age;
|
||||||
|
}
|
||||||
|
}
|
29
Emne 3/ObjekterIListe/ObjekterIListe/Program.cs
Normal file
29
Emne 3/ObjekterIListe/ObjekterIListe/Program.cs
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
namespace ObjekterIListe
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static public void AddPeople()
|
||||||
|
{
|
||||||
|
List<Person> people = new List<Person>();
|
||||||
|
Person person1 = new Person("Alice", "Smith", 25);
|
||||||
|
Person person2 = new Person("Bob", "Jones", 37);
|
||||||
|
Person person3 = new Person("Charlie", "Jones", 28);
|
||||||
|
|
||||||
|
people.Add(person1);
|
||||||
|
people.Add(person2);
|
||||||
|
people.Add(person3);
|
||||||
|
WriteToConsole(people);
|
||||||
|
|
||||||
|
}
|
||||||
|
static void WriteToConsole(this List<Person> people)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < people.Count; i++)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Fornavn: {people[i].FirstName}\nEtternavn: {people[i].LastName}\nAlder: {people[i].Age}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static void Main(string[] args){
|
||||||
|
AddPeople();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Emne 3/Pokedex/Pokedex.csproj
Normal file
11
Emne 3/Pokedex/Pokedex.csproj
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>enable</Nullable>
|
||||||
|
<RootNamespace>Pokemon</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
22
Emne 3/Pokedex/Program.cs
Normal file
22
Emne 3/Pokedex/Program.cs
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
using System;
|
||||||
|
namespace Pokedex
|
||||||
|
{
|
||||||
|
// 1/3 Planning
|
||||||
|
// 1/6 Coding
|
||||||
|
// 1/4 component test and early system test
|
||||||
|
// 1/4 system test, all components in hand
|
||||||
|
// - "The Mythical Man Month" by Frederick P. Brooks
|
||||||
|
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
var pikachu = new Pokemon("Pikachu", 10, 30);
|
||||||
|
Console.WriteLine($"{pikachu.Name} har {pikachu.Health} hp og er level {pikachu.Level}");
|
||||||
|
|
||||||
|
var bulbasaur = new Pokemon("Bulbasaur",20, 90);
|
||||||
|
Console.WriteLine($"{bulbasaur.Name} har {bulbasaur.Health} hp og er level {bulbasaur.Level}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
15
Emne 3/Pokedex/pokedex.cs
Normal file
15
Emne 3/Pokedex/pokedex.cs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
namespace Pokedex;
|
||||||
|
|
||||||
|
public class Pokemon
|
||||||
|
{
|
||||||
|
internal int Health;
|
||||||
|
internal int Level;
|
||||||
|
internal string Name;
|
||||||
|
|
||||||
|
public Pokemon(string name, int level, int health)
|
||||||
|
{
|
||||||
|
Name = name;
|
||||||
|
Level = level;
|
||||||
|
Health = health;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,19 +0,0 @@
|
||||||
using System;
|
|
||||||
using Pokedex;
|
|
||||||
namespace Pokemon
|
|
||||||
{
|
|
||||||
// 1/3 Planning
|
|
||||||
// 1/6 Coding
|
|
||||||
// 1/4 component test and early system test
|
|
||||||
// 1/4 system test, all components in hand
|
|
||||||
// - "The Mythical Man Month" by Frederick P. Brooks
|
|
||||||
class Program
|
|
||||||
{
|
|
||||||
static void Main(string[] args)
|
|
||||||
{
|
|
||||||
var pikachu = new Pikachu();
|
|
||||||
Console.WriteLine($"Pikachu har {Pikachu.Health}hp og er level {Pikachu.Level}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
namespace Pokedex;
|
|
||||||
|
|
||||||
public class Pikachu
|
|
||||||
{
|
|
||||||
internal static int Health = 50;
|
|
||||||
internal static int Level = 21;
|
|
||||||
}
|
|
Loading…
Reference in a new issue