Az épulet projekt elkészült.
This commit is contained in:
parent
1101f1689e
commit
caa18acd08
67
LakoEpulet/Epulet.cs
Normal file
67
LakoEpulet/Epulet.cs
Normal file
|
@ -0,0 +1,67 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace LakoEpulet
|
||||||
|
{
|
||||||
|
|
||||||
|
class Festek
|
||||||
|
{
|
||||||
|
public static double literpernegyzetmeter = 0.3;
|
||||||
|
}
|
||||||
|
class Epulet
|
||||||
|
{
|
||||||
|
private List<LakoHelyiseg> helyisegek;
|
||||||
|
|
||||||
|
//A szükséges falfesték property-ként
|
||||||
|
public double FalfestekLiter
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
double ofelulet = 0;
|
||||||
|
foreach (var item in helyisegek)
|
||||||
|
{
|
||||||
|
ofelulet += item.falfelulet + item.mennyezet();
|
||||||
|
}
|
||||||
|
return ofelulet * Festek.literpernegyzetmeter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Epulet()
|
||||||
|
{
|
||||||
|
helyisegek = new List<LakoHelyiseg>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void bekeres()
|
||||||
|
{
|
||||||
|
Console.WriteLine("Hány helyiség van az épületben?");
|
||||||
|
int hdb = int.Parse(Console.ReadLine());
|
||||||
|
for (int i = 0; i < hdb; i++)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Az {i+1}. helyiség adatai:");
|
||||||
|
Console.Write("szélessége: ");
|
||||||
|
double sz = double.Parse(Console.ReadLine().Replace('.', ','));
|
||||||
|
Console.Write("hosszúsága: ");
|
||||||
|
double h = double.Parse(Console.ReadLine().Replace('.', ','));
|
||||||
|
Console.Write("magassága: ");
|
||||||
|
double m = double.Parse(Console.ReadLine().Replace('.',','));
|
||||||
|
LakoHelyiseg ujh = new LakoHelyiseg(sz, h, m);
|
||||||
|
helyisegek.Add(ujh);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public double Burkolat()
|
||||||
|
{
|
||||||
|
double oterulet = 0;
|
||||||
|
foreach (var item in helyisegek)
|
||||||
|
{
|
||||||
|
oterulet += item.alapterulet;
|
||||||
|
}
|
||||||
|
return oterulet;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
8
LakoEpulet/LakoEpulet.csproj
Normal file
8
LakoEpulet/LakoEpulet.csproj
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>Exe</OutputType>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
</Project>
|
50
LakoEpulet/LakoHelyiseg.cs
Normal file
50
LakoEpulet/LakoHelyiseg.cs
Normal file
|
@ -0,0 +1,50 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace LakoEpulet
|
||||||
|
{
|
||||||
|
class LakoHelyiseg
|
||||||
|
{
|
||||||
|
|
||||||
|
//Publikus adattag változók
|
||||||
|
public double szelesseg;
|
||||||
|
public double hosszusag;
|
||||||
|
public double magassag;
|
||||||
|
|
||||||
|
//Property - Tulajdonság
|
||||||
|
public double alapterulet
|
||||||
|
{
|
||||||
|
get { return szelesseg*hosszusag; }
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public double falfelulet
|
||||||
|
{
|
||||||
|
get {
|
||||||
|
return (2 * szelesseg + 2 * hosszusag) * magassag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public LakoHelyiseg(double szelesseg,double hosszusag,double magassag)
|
||||||
|
{
|
||||||
|
this.szelesseg = szelesseg;
|
||||||
|
this.hosszusag = hosszusag;
|
||||||
|
this.magassag = magassag;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//Adatok kiolvasása metódusokkal
|
||||||
|
public double mennyezet()
|
||||||
|
{
|
||||||
|
return szelesseg * hosszusag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double legkobmeter()
|
||||||
|
{
|
||||||
|
return szelesseg * hosszusag * magassag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
15
LakoEpulet/Program.cs
Normal file
15
LakoEpulet/Program.cs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace LakoEpulet
|
||||||
|
{
|
||||||
|
class Program
|
||||||
|
{
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
Epulet ujepulet = new Epulet();
|
||||||
|
ujepulet.bekeres();
|
||||||
|
Console.WriteLine($"A szükséges festékmennyiség: {ujepulet.FalfestekLiter:F2} liter");
|
||||||
|
Console.WriteLine($"A szükséges padlólap: {ujepulet.Burkolat()} nm");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 16
|
# Visual Studio Version 16
|
||||||
VisualStudioVersion = 16.0.31624.102
|
VisualStudioVersion = 16.0.31624.102
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "KartyaOszto", "KartyaOszto\KartyaOszto.csproj", "{3B2D2794-EA0A-4863-B594-87FFDC8E9605}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "KartyaOszto", "KartyaOszto\KartyaOszto.csproj", "{3B2D2794-EA0A-4863-B594-87FFDC8E9605}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LakoEpulet", "LakoEpulet\LakoEpulet.csproj", "{411543CA-172A-413E-B444-4C59C9A668EE}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -15,6 +17,10 @@ Global
|
||||||
{3B2D2794-EA0A-4863-B594-87FFDC8E9605}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{3B2D2794-EA0A-4863-B594-87FFDC8E9605}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{3B2D2794-EA0A-4863-B594-87FFDC8E9605}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{3B2D2794-EA0A-4863-B594-87FFDC8E9605}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{3B2D2794-EA0A-4863-B594-87FFDC8E9605}.Release|Any CPU.Build.0 = Release|Any CPU
|
{3B2D2794-EA0A-4863-B594-87FFDC8E9605}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{411543CA-172A-413E-B444-4C59C9A668EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{411543CA-172A-413E-B444-4C59C9A668EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{411543CA-172A-413E-B444-4C59C9A668EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{411543CA-172A-413E-B444-4C59C9A668EE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
|
Loading…
Reference in New Issue
Block a user