Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
65 changes: 50 additions & 15 deletions AppsLab.CSharp.Exercises.sln
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-033-NuGet", "src\Ap
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AppsLab-034-Debug", "src\AppsLab-034-Debug\AppsLab-034-Debug.csproj", "{83C963FD-DC23-46E8-9545-F56197164810}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "test", "test\test.csproj", "{5524A60A-E442-43DC-B5D3-F12129B2B1DB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "projekt1", "projekt1\projekt1.csproj", "{A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "kalkulacka", "ROJEKT2\kalkulacka.csproj", "{C8E34CC7-534B-4183-8794-CEE3803436BE}"
EndProject
Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Expand Down Expand Up @@ -226,18 +229,6 @@ Global
{A6659FD2-5F11-432B-91B7-C64EAEAF669C}.Release|x64.Build.0 = Release|Any CPU
{A6659FD2-5F11-432B-91B7-C64EAEAF669C}.Release|x86.ActiveCfg = Release|Any CPU
{A6659FD2-5F11-432B-91B7-C64EAEAF669C}.Release|x86.Build.0 = Release|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x64.ActiveCfg = Debug|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x64.Build.0 = Debug|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x86.ActiveCfg = Debug|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Debug|x86.Build.0 = Debug|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|Any CPU.Build.0 = Release|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x64.ActiveCfg = Release|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x64.Build.0 = Release|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x86.ActiveCfg = Release|Any CPU
{B141B973-9C0B-4512-B8B4-1237B596A8D2}.Release|x86.Build.0 = Release|Any CPU
{FD645D4C-9DC8-4603-A77B-8A4782F175F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FD645D4C-9DC8-4603-A77B-8A4782F175F4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FD645D4C-9DC8-4603-A77B-8A4782F175F4}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -634,6 +625,45 @@ Global
{83C963FD-DC23-46E8-9545-F56197164810}.Release|x64.Build.0 = Release|Any CPU
{83C963FD-DC23-46E8-9545-F56197164810}.Release|x86.ActiveCfg = Release|Any CPU
{83C963FD-DC23-46E8-9545-F56197164810}.Release|x86.Build.0 = Release|Any CPU
{5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Debug|x64.ActiveCfg = Debug|Any CPU
{5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Debug|x64.Build.0 = Debug|Any CPU
{5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Debug|x86.ActiveCfg = Debug|Any CPU
{5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Debug|x86.Build.0 = Debug|Any CPU
{5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Release|Any CPU.Build.0 = Release|Any CPU
{5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Release|x64.ActiveCfg = Release|Any CPU
{5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Release|x64.Build.0 = Release|Any CPU
{5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Release|x86.ActiveCfg = Release|Any CPU
{5524A60A-E442-43DC-B5D3-F12129B2B1DB}.Release|x86.Build.0 = Release|Any CPU
{A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Debug|x64.ActiveCfg = Debug|Any CPU
{A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Debug|x64.Build.0 = Debug|Any CPU
{A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Debug|x86.ActiveCfg = Debug|Any CPU
{A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Debug|x86.Build.0 = Debug|Any CPU
{A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Release|Any CPU.Build.0 = Release|Any CPU
{A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Release|x64.ActiveCfg = Release|Any CPU
{A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Release|x64.Build.0 = Release|Any CPU
{A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Release|x86.ActiveCfg = Release|Any CPU
{A02049C9-C1E0-4BFF-BAE0-1C83A0D16BCC}.Release|x86.Build.0 = Release|Any CPU
{C8E34CC7-534B-4183-8794-CEE3803436BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8E34CC7-534B-4183-8794-CEE3803436BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8E34CC7-534B-4183-8794-CEE3803436BE}.Debug|x64.ActiveCfg = Debug|Any CPU
{C8E34CC7-534B-4183-8794-CEE3803436BE}.Debug|x64.Build.0 = Debug|Any CPU
{C8E34CC7-534B-4183-8794-CEE3803436BE}.Debug|x86.ActiveCfg = Debug|Any CPU
{C8E34CC7-534B-4183-8794-CEE3803436BE}.Debug|x86.Build.0 = Debug|Any CPU
{C8E34CC7-534B-4183-8794-CEE3803436BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C8E34CC7-534B-4183-8794-CEE3803436BE}.Release|Any CPU.Build.0 = Release|Any CPU
{C8E34CC7-534B-4183-8794-CEE3803436BE}.Release|x64.ActiveCfg = Release|Any CPU
{C8E34CC7-534B-4183-8794-CEE3803436BE}.Release|x64.Build.0 = Release|Any CPU
{C8E34CC7-534B-4183-8794-CEE3803436BE}.Release|x86.ActiveCfg = Release|Any CPU
{C8E34CC7-534B-4183-8794-CEE3803436BE}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{57860CA2-0054-465E-BD1E-024FF8D81354} = {56555FB0-B513-49EF-9002-A5AF135EA090}
Expand Down Expand Up @@ -679,5 +709,10 @@ Global
{7BEA7878-B5BA-4480-BC56-2F7B836F64B9} = {56555FB0-B513-49EF-9002-A5AF135EA090}
{38FFE1DF-4B49-40C1-9908-51860BCF2D3E} = {56555FB0-B513-49EF-9002-A5AF135EA090}
{83C963FD-DC23-46E8-9545-F56197164810} = {56555FB0-B513-49EF-9002-A5AF135EA090}
{5524A60A-E442-43DC-B5D3-F12129B2B1DB} = {56555FB0-B513-49EF-9002-A5AF135EA090}
{C8E34CC7-534B-4183-8794-CEE3803436BE} = {56555FB0-B513-49EF-9002-A5AF135EA090}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {87DB432D-BF83-4F67-A077-8E0F02BE9F55}
EndGlobalSection
EndGlobal
40 changes: 40 additions & 0 deletions ROJEKT2/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Console.WriteLine("Zadaj prve cislo: ");
decimal cislo1 = decimal.Parse(Console.ReadLine());
Console.WriteLine("Zadaj druhe cislo:");
decimal cislo2 = decimal.Parse(Console.ReadLine());
Console.WriteLine("Zadaj operaciu (+, -, *, /, %):");
string operacia = Console.ReadLine();
if (operacia == "/" && cislo2 == 0)
{
Console.WriteLine("Chyba: Delenie nulou nie je povolene.");
return;
}
if (operacia != "+" && operacia != "-" && operacia != "*" && operacia != "/" && operacia != "%")
{
Console.WriteLine("Chyba: Neplatna operacia.");
return;
}

decimal vysedlok = operacia switch
{
"+" => (cislo1 + cislo2),
"-" => (cislo1 - cislo2),
"*" => (cislo1 * cislo2),
"/" => (cislo1 / cislo2),
"%" => (cislo1 % cislo2),
};
Console.WriteLine($"Vysledok je: {vysedlok}");
Console.WriteLine("Stlac ENTER pre spustenie kalkulacky");
Console.ReadLine();
System.Diagnostics.Process.Start("kalkulacka.exe");
System.Environment.Exit(0);




// nacitam prve cslo
//nacitam operaciu
//nacitam druhe cislo
//vypisem vypisem operaciu
//vypisem vysledok

10 changes: 10 additions & 0 deletions ROJEKT2/kalkulacka.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
16 changes: 16 additions & 0 deletions projekt1/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
int a = 10;
int b = 5;
int plus = a + b;
int minus = a - b;
int krat = a * b;
int deleno = a / b;
int zostatok = a % b;
bool rovnake = a == b;
bool rozne = a != b;
bool vacsie = a > b;
bool mensie = a < b;
bool vacsieRovnake = a >= b;
bool mensieRovnake = a <= b;
Console.WriteLine($"{plus} {minus} {krat} {deleno} {zostatok} {rovnake} {rozne} {vacsie} { mensie} {vacsieRovnake} {mensieRovnake}");


10 changes: 10 additions & 0 deletions projekt1/projekt1.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

</Project>
2 changes: 1 addition & 1 deletion src/AppsLab-001-StartHere/Greetings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ public class Greetings
/// <returns>A string containing the greeting message.</returns>
public string Hello()
{
return "Hello World!";
return "Hello AppsLab!";
}
}
5 changes: 4 additions & 1 deletion src/AppsLab-002-ConsoleWriteLine/Program.cs
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
Console.WriteLine("Hello, World!");
int age = 14;
string name= "John";

Console.WriteLine($"Hello my name is {name} and i am {age} years old ");
2 changes: 1 addition & 1 deletion src/AppsLab-005-DataTypes/AppsLab-005-DataTypes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<RootNamespace>AppsLab_005_DataTypes</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down
13 changes: 11 additions & 2 deletions src/AppsLab-005-DataTypes/Program.cs
Original file line number Diff line number Diff line change
@@ -1,2 +1,11 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
int cislo = 10;
string text = "test1";
char znak = 'a';
bool mojahodnota = true;
decimal test = 10.5m;
DateTime dnesnydatum = DateTime.Now;
int sucet = cislo + 67;
float desatinne = 1.23f;
var meno = "Alex";
Console.WriteLine($"cislo JE {cislo.ToString("000")} T" +
$"TEXT JE {text} znak je {znak} hodnota bool je {mojahodnota} decimal je {test} dnesny datum je {dnesnydatum.ToString("yyyy-MM-dd")} sucet cisla {cislo} a 67 je : {sucet} Desatinne cislo je {desatinne} meno je {meno}");
9 changes: 7 additions & 2 deletions src/AppsLab-006-Constants/Program.cs
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
const int MaxPoints = 100;
const int MinAgeForDriversLicense = 17;
const string WelcomeMessage = "Vitaj v nasej hre!";
Console.WriteLine($"maximalny pocet bodov je {MaxPoints}");
Console.WriteLine($"minimalny vek na vodicak je { MinAgeForDriversLicense}");
Console.WriteLine($"welcome message je {WelcomeMessage}");

14 changes: 7 additions & 7 deletions src/AppsLab-007-Casting/Converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,54 +10,54 @@ public class Converter
/// </summary>
public double IntToDouble(int number)
{
throw new NotImplementedException();
return Convert.ToDouble(number);
}

/// <summary>
/// This method converts a double to an integer.
/// </summary>
public int DoubleToInt(double number)
{
throw new NotImplementedException();
return Convert.ToInt32(number);
}

/// <summary>
/// This method converts a string to a double.
/// </summary>
public double StringToDouble(string number)
{
throw new NotImplementedException();
return Convert.ToDouble(number);
}

/// <summary>
/// This method converts a double to a string.
/// </summary>
public string DoubleToString(double number)
{
throw new NotImplementedException();
return Convert.ToString(number);
}

/// <summary>
/// This method converts a string to a boolean.
/// </summary>
public string IntToString(int number)
{
throw new NotImplementedException();
return Convert.ToString(number);
}

/// <summary>
/// This method converts a boolean to a string.
/// </summary>
public bool StringToBool(string boolValue)
{
throw new NotImplementedException();
return Convert.ToBoolean(boolValue);
}

/// <summary>
/// This method converts a boolean to a string.
/// </summary>
public string BoolToString(bool boolValue)
{
throw new NotImplementedException();
return Convert.ToString(boolValue);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\AppsLab-005-DataTypes\AppsLab-005-DataTypes.csproj" />
</ItemGroup>

</Project>
31 changes: 23 additions & 8 deletions src/AppsLab-008-ConsoleReadLine/Program.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
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.");
// privitanie
Console.WriteLine("Vitaj v kalkulacke!");
// zadame cislo a operciu
Console.WriteLine("Zadaj prve cislo:");
int cislo = int.Parse(Console.ReadLine()!);
Console.WriteLine("Zadaj druhe cislo:");
int cislo2 = int.Parse(Console.ReadLine()!);
Console.WriteLine("Zadaj operaciu (+, -, *, /, ):");
string operacia = Console.ReadLine()!;
int vysledok = operacia switch
// zvolim operaciu a spocittamm
{
"+" => cislo + cislo2,
"-" => cislo - cislo2,
"*" => cislo * cislo2,
"/" => cislo / cislo2,
};
// vypisem vysledok
Console.WriteLine($"Vysledok je: {vysledok}");




Loading