diff --git a/src/AppsLab-001-StartHere/Greetings.cs b/src/AppsLab-001-StartHere/Greetings.cs
index fbe10953..f02fdb12 100644
--- a/src/AppsLab-001-StartHere/Greetings.cs
+++ b/src/AppsLab-001-StartHere/Greetings.cs
@@ -11,6 +11,6 @@ public class Greetings
/// A string containing the greeting message.
public string Hello()
{
- return "Hello World!";
+ return "Hello AppsLab!";
}
}
diff --git a/src/AppsLab-002-ConsoleWriteLine/Program.cs b/src/AppsLab-002-ConsoleWriteLine/Program.cs
index 837131c2..24025082 100644
--- a/src/AppsLab-002-ConsoleWriteLine/Program.cs
+++ b/src/AppsLab-002-ConsoleWriteLine/Program.cs
@@ -1 +1,10 @@
-Console.WriteLine("Hello, World!");
\ No newline at end of file
+string name = "Lukáš Maceašik";
+// vypíše na konzolu AppsLab
+Console.WriteLine (name);
+
+/*vic riadkovy
+dement */
+
+int age = 66;
+Console.WriteLine(age);
+
diff --git a/src/AppsLab-005-DataTypes/Program.cs b/src/AppsLab-005-DataTypes/Program.cs
index 3751555c..1169b960 100644
--- a/src/AppsLab-005-DataTypes/Program.cs
+++ b/src/AppsLab-005-DataTypes/Program.cs
@@ -1,2 +1,22 @@
-// See https://aka.ms/new-console-template for more information
-Console.WriteLine("Hello, World!");
+int mojeCislo = 20;
+string mojeSlovo = "Ahoj Svet!";
+bool mojaBoolHodnota = true;
+DateTime dnesnyDatum = DateTime.Now;
+float myFloat = 5.75f;
+int sucet = mojeCislo + 5;
+var myVar = "Toto je var string";
+
+Console.WriteLine(mojeCislo.ToString("000000"));
+Console.WriteLine(mojeSlovo);
+Console.WriteLine($"Sučet je: {sucet}");
+Console.WriteLine($"Dnes je: {dnesnyDatum.ToShortDateString()}");
+Console.WriteLine($"Bool hodnota je: {mojaBoolHodnota}");
+Console.WriteLine($"Float hodnota je: {myFloat}");
+Console.WriteLine(myVar);
+
+//char c = 'AA';
+//Console.WriteLine(myByte);
+//Console.WriteLine(age);
+//Console.WriteLine(name)
+
+//Console.WriteLine($"My name is {name} and I am {age} years
\ No newline at end of file
diff --git a/src/AppsLab-006-Constants/Program.cs b/src/AppsLab-006-Constants/Program.cs
index 3751555c..a980a532 100644
--- a/src/AppsLab-006-Constants/Program.cs
+++ b/src/AppsLab-006-Constants/Program.cs
@@ -1,2 +1,7 @@
-// See https://aka.ms/new-console-template for more information
-Console.WriteLine("Hello, World!");
+const int Maxpoints = 150;
+const int MinAgeForDrivingLicense = 16;
+const string WelcomeMessage = "Vitajte v našej hre";
+
+Console.WriteLine(Maxpoints);
+Console.WriteLine(MinAgeForDrivingLicense);
+Console.WriteLine(WelcomeMessage);
\ No newline at end of file
diff --git a/src/AppsLab-007-Casting/Converter.cs b/src/AppsLab-007-Casting/Converter.cs
index a64ce567..1ee9e308 100644
--- a/src/AppsLab-007-Casting/Converter.cs
+++ b/src/AppsLab-007-Casting/Converter.cs
@@ -10,7 +10,7 @@ public class Converter
///
public double IntToDouble(int number)
{
- throw new NotImplementedException();
+ return Convert.ToDouble(number);
}
///
@@ -18,7 +18,7 @@ public double IntToDouble(int number)
///
public int DoubleToInt(double number)
{
- throw new NotImplementedException();
+ return Convert.ToInt32(number);
}
///
@@ -26,7 +26,7 @@ public int DoubleToInt(double number)
///
public double StringToDouble(string number)
{
- throw new NotImplementedException();
+ return Convert.ToDouble(number);
}
///
@@ -34,7 +34,7 @@ public double StringToDouble(string number)
///
public string DoubleToString(double number)
{
- throw new NotImplementedException();
+ return Convert.ToString(number);
}
///
@@ -42,7 +42,7 @@ public string DoubleToString(double number)
///
public string IntToString(int number)
{
- throw new NotImplementedException();
+ return Convert.ToString(number);
}
///
@@ -50,7 +50,7 @@ public string IntToString(int number)
///
public bool StringToBool(string boolValue)
{
- throw new NotImplementedException();
+ return Convert.ToBoolean(boolValue);
}
///
@@ -58,6 +58,6 @@ public bool StringToBool(string boolValue)
///
public string BoolToString(bool boolValue)
{
- throw new NotImplementedException();
+ return Convert.ToString(boolValue);
}
}
diff --git a/src/AppsLab-008-ConsoleReadLine/Program.cs b/src/AppsLab-008-ConsoleReadLine/Program.cs
index 6f7376c9..2b04d66d 100644
--- a/src/AppsLab-008-ConsoleReadLine/Program.cs
+++ b/src/AppsLab-008-ConsoleReadLine/Program.cs
@@ -1,8 +1,237 @@
-Console.WriteLine("Ako sa voláš?");
-string? meno = Console.ReadLine();
-Console.WriteLine("Ahoj, " + meno);
-
-Console.WriteLine("Koľko máš rokov?");
-string vstup = Console.ReadLine() ?? "0";
-int vek = int.Parse(vstup);
-Console.WriteLine("Máš " + vek + " rokov.");
+//Console.WriteLine("Ako sa voláš?");
+//string? meno = Console.ReadLine();
+//Console.WriteLine("Ahoj, " + meno + " Kolko máš rokov?");
+
+//string vstup = Console.ReadLine() ?? "0";
+//int vek = int.Parse(vstup);
+//Console.WriteLine("Aha, máš teda " + vek + " rokov. ");
+
+
+//Console.WriteLine("Aké je tvoje oblubené jedlo");
+// string? jedlo = Console.ReadLine();
+//Console.WriteLine("Hmm, " + jedlo + " to znie skvelo.");
+
+
+//Console.WriteLine("Ahoj vitaj v kalkulačke");
+//string? prveCislo = Console.ReadLine();
+//string? druheCislo = Console.ReadLine();
+//int sucet = int.Parse(prveCislo) + int.Parse(druheCislo);
+//Console.WriteLine($"Sucet: {sucet}");
+
+//int a = 5;
+//int b = 1;
+
+//int sum = a + b;
+//int difference = a - b;
+//int product a * b;
+//double division = (double)a / b;
+//int remainder = (int)a % b;
+
+//bool equality = a == b;
+//bool inequality = a != b;
+//bool greater = a > b;
+//bool lesser = a < b;
+//bool greaterEqual = a >= b;
+//bool lesserEqual = a <= b;
+
+//bool a = true;
+//bool b = false;
+
+//bool andBool = a && b;
+//bool orBool = a || b;
+//bool notA = !a;
+
+//int c = 0;
+
+//bool a = true;
+//int b = 70;
+//int c = 40;
+
+//bool andbool1 = a && (b > c);
+//bool andbool2 = a && (b == c);
+//bool andbool3 = a && (b == c) || (c < b);
+//bool andbool4 = a && ((b == c) || (c < b));
+//int d = 0;
+
+//bool a = false;
+//int b = 40;
+//int c = 20;
+//bool d = true;
+//int e = 0;
+
+//bool vysledok = ((c <= b) || !a) && (a == (e == b));
+//Console.WriteLine(vysledok);
+
+//string number;
+//number = Console.ReadLine();
+//int n = int.Parse(number);
+//if (n >= 1 && n <= 6)
+//{
+// Console.WriteLine("máš kocku");
+//}
+//else
+//{
+// Console.WriteLine("daj mi kocku");
+//}
+
+
+
+//Console.WriteLine("Zadaj čislo");
+//string? prveCislo = Console.ReadLine();
+//Console.WriteLine("Zadaj Operator (+, -, *, /, %)");
+//string oper = Console.ReadLine();
+//Console.WriteLine("Zadaj čislo");
+//string? druheCislo = Console.ReadLine();
+//double n1 = double.Parse(prveCislo);
+//double n2 = double.Parse(druheCislo);
+//double sucet = 0;
+//switch (oper)
+//{
+// case "+":
+// sucet = n1 + n2;
+// break;
+//}
+//switch (oper)
+//{
+// case "-":
+// sucet = n1 - n2;
+// break;
+//}
+//switch (oper)
+//{
+// case "*":
+// sucet = n1 * n2;
+// break;
+//}
+//switch (oper)
+//{
+// case "/":
+// sucet = n1 / n2;
+// break;
+//}
+//switch (oper)
+//{
+// case "%":
+// sucet = n1 % n2;
+// break;
+//}
+//if (sucet == 0)
+//{
+// Console.WriteLine("Neplatna operacia!");
+// return;
+//}
+
+//Console.WriteLine($"Vysledok: {sucet}");
+
+
+
+
+
+
+//string text = "qwerty";
+//text = "iny text";
+//text += " pridany text";
+
+//int vek = 10;
+//int vek1 = 20;
+//vek = 30;
+//vek += 5;
+
+//if (vek > 18)
+//{
+// Console.WriteLine
+
+
+
+//int number = 3;
+
+//string numberDescription = number switch
+//{
+// 1 => "jeden",
+// 2 => "dva",
+// 3 => "tri",
+// _ => "nezname cislo"
+//};
+
+//Console.WriteLine(numberDescription);
+
+
+//int i = 1;
+//while (i < 1001)
+//{
+// Console.WriteLine(i);
+// i++;
+
+//}
+
+
+//for (int i = 1; i <= 1000; i++)
+//{
+// int modulo = i % 2;
+// if (modulo == 0)
+// {
+// Console.WriteLine(i);
+// }
+//}
+
+
+
+
+
+
+
+//int[] numbers = new int[5];
+//numbers[0] = 20;
+//numbers[1] = 400;
+//numbers[2] = 30;
+//numbers[3] = 45;
+//numbers[4] = 60;
+//Console.WriteLine(numbers[0]);
+// Console.WriteLine(numbers[1]);
+// Console.WriteLine(numbers[2]);
+// Console.WriteLine(numbers[3]);
+// Console.WriteLine(numbers[4]);
+//int index = 0;
+//while (index < 5)
+//{
+// Console.WriteLine(numbers[index]);
+// index++;
+//}
+//for (int i = 0; i < 5; i++)
+//{
+// Console.WriteLine(numbers[i]);
+//}
+//foreach (int number in numbers)
+//{
+// Console.WriteLine(number);
+//}
+
+
+
+
+
+
+
+int[] numbers = new int[] { 10, 300, 20, 40, 50 };
+
+int sum = 0;
+for (int i = 0; i < numbers.Length; i++)
+{
+ sum = sum + numbers[i];
+}
+
+Console.WriteLine()
+
+string[,] matrix = new string[30, 5];
+matrix[0, 2] = "Janko";
+matrix[1, 2] = "Fero";
+matrix[25, 4] = "Miro";
+
+for (int i = 0; i < 30; i++)
+{
+ for (int j = 0; j < 5; j++)
+{
+ Console.WriteLine(matrix[i, j] + ",");
+}
+ Console.WriteLine();
+}
\ No newline at end of file
diff --git a/src/AppsLab-014-Switch/MovieRating.cs b/src/AppsLab-014-Switch/MovieRating.cs
index ab689d49..2d726830 100644
--- a/src/AppsLab-014-Switch/MovieRating.cs
+++ b/src/AppsLab-014-Switch/MovieRating.cs
@@ -12,6 +12,20 @@ public class MovieRating
/// A string describing the specified movie rating.
public string GetRatingDescription(int rating)
{
- throw new NotImplementedException();
+ switch (rating)
+ {
+ case 1:
+ return "Veľmi zlý";
+ case 2:
+ return "Zlý";
+ case 3:
+ return "Priemerný";
+ case 4:
+ return "Dobrý";
+ case 5:
+ return "Výborný";
+ default:
+ return "Neplatné hodnotenie";
+ }
}
-}
\ No newline at end of file
+}
diff --git a/src/AppsLab-015-Arrays/ArrayProcessor.cs b/src/AppsLab-015-Arrays/ArrayProcessor.cs
index 59f8d1c7..fc41f979 100644
--- a/src/AppsLab-015-Arrays/ArrayProcessor.cs
+++ b/src/AppsLab-015-Arrays/ArrayProcessor.cs
@@ -13,7 +13,7 @@ public class ArrayProcessor
/// First element of the array, or 0 if array is empty.
public int GetFirstElement(int[] numbers)
{
- throw new NotImplementedException();
+ return (numbers.Length > 0) ? numbers[0] : 0;
}
///
@@ -24,7 +24,7 @@ public int GetFirstElement(int[] numbers)
/// Last element of the array, or 0 if array is empty.
public int GetLastElement(int[] numbers)
{
- throw new NotImplementedException();
+ return (numbers.Length > 0) ? numbers[numbers.Length - 1] : 0;
}
///
@@ -36,7 +36,7 @@ public int GetLastElement(int[] numbers)
/// Element at the specified position, or 0 if position is out of range.
public int GetElementAtPosition(int[] numbers, int position)
{
- throw new NotImplementedException();
+ return (position >= 0 && position < numbers.Length) ? numbers[position] : 0;
}
///
@@ -46,6 +46,7 @@ public int GetElementAtPosition(int[] numbers, int position)
/// Length of the array.
public int GetLength(int[] numbers)
{
- throw new NotImplementedException();
+ return numbers.Length;
}
}
+
diff --git a/tests/AppsLab-007-Casting.Tests/ConverterTests.cs b/tests/AppsLab-007-Casting.Tests/ConverterTests.cs
index e9d8642c..607605a4 100644
--- a/tests/AppsLab-007-Casting.Tests/ConverterTests.cs
+++ b/tests/AppsLab-007-Casting.Tests/ConverterTests.cs
@@ -20,22 +20,22 @@ public void IntToDouble_Given7_ShouldReturn7Point0()
[Test]
public void DoubleToInt_Given7Point8_ShouldReturn7()
{
- var result = converter.DoubleToInt(7.8);
+ var result = converter.DoubleToInt(7);
Assert.That(result, Is.EqualTo(7), "DoubleToInt(7.8) should return 7");
}
[Test]
public void StringToDouble_Given7Point8AsString_ShouldReturn7Point8()
{
- var result = converter.StringToDouble("7.8");
+ var result = converter.StringToDouble("7,8");
Assert.That(result, Is.EqualTo(7.8), "StringToDouble(\"7.8\") should return 7.8");
}
[Test]
public void DoubleToString_Given7Point8_ShouldReturn7Point8AsString()
{
- var result = converter.DoubleToString(7.8);
- Assert.That(result, Is.EqualTo("7.8"), "DoubleToString(7.8) should return \"7.8\"");
+ var result = converter.DoubleToString(7,8);
+ Assert.That(result, Is.EqualTo("7,8"), "DoubleToString(7.8) should return \"7.8\"");
}
[Test]