Épület projekt megvalósítása.
This commit is contained in:
parent
4d5da751ae
commit
31062418e1
64
EpuletProjekt/Epulet.cs
Normal file
64
EpuletProjekt/Epulet.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace EpuletProjekt
|
||||
{
|
||||
class Epulet
|
||||
{
|
||||
private List<Lakohelyiseg> lhlista;
|
||||
|
||||
public double koNegyzetmeter
|
||||
{
|
||||
get
|
||||
{
|
||||
double nm = 0;
|
||||
foreach (Lakohelyiseg item in lhlista)
|
||||
{
|
||||
nm += item.alapterulet;
|
||||
}
|
||||
return nm;
|
||||
}
|
||||
}
|
||||
|
||||
public Epulet()
|
||||
{
|
||||
lhlista = new List<Lakohelyiseg>();
|
||||
}
|
||||
|
||||
public void beKeres()
|
||||
{
|
||||
string menupont = "";
|
||||
do
|
||||
{
|
||||
Console.WriteLine("a: Új helyiség hozzáadása\nq: Kilépés a menüből");
|
||||
menupont = Console.ReadLine();
|
||||
if(menupont=="a")
|
||||
{
|
||||
Console.WriteLine("Adja meg a helyiség hosszát méterben!");
|
||||
double h = double.Parse(Console.ReadLine());
|
||||
Console.WriteLine("Adja meg a helyiség szélességét méterben!");
|
||||
double sz = double.Parse(Console.ReadLine());
|
||||
Console.WriteLine("Adja meg a helyiség magasságát méterben!");
|
||||
double m = double.Parse(Console.ReadLine());
|
||||
lhlista.Add(new Lakohelyiseg(h, sz, m));
|
||||
} else if(menupont=="q")
|
||||
{
|
||||
Console.WriteLine($"Az épületben {lhlista.Count} db helyiség van.");
|
||||
}
|
||||
|
||||
} while (menupont != "q");
|
||||
}
|
||||
|
||||
public double festekLiter(double lpnm)
|
||||
{
|
||||
double nm = 0;
|
||||
foreach (Lakohelyiseg item in lhlista)
|
||||
{
|
||||
nm += (item.falfelulet + item.mennyezet);
|
||||
|
||||
}
|
||||
return nm * lpnm;
|
||||
}
|
||||
}
|
||||
}
|
8
EpuletProjekt/EpuletProjekt.csproj
Normal file
8
EpuletProjekt/EpuletProjekt.csproj
Normal file
|
@ -0,0 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
92
EpuletProjekt/Lakohelyiseg.cs
Normal file
92
EpuletProjekt/Lakohelyiseg.cs
Normal file
|
@ -0,0 +1,92 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace EpuletProjekt
|
||||
{
|
||||
class Lakohelyiseg
|
||||
{
|
||||
private double hossz;
|
||||
private double szelesseg;
|
||||
private double magassag;
|
||||
private double _alapterulet;
|
||||
|
||||
//Az alapterulet nevű property megadása
|
||||
public double alapterulet {
|
||||
get
|
||||
{
|
||||
_alapterulet = hossz * szelesseg;
|
||||
return _alapterulet;
|
||||
}
|
||||
}
|
||||
|
||||
public double legkobmeter
|
||||
{
|
||||
get
|
||||
{
|
||||
return hossz * szelesseg * magassag;
|
||||
}
|
||||
}
|
||||
|
||||
public double falfelulet
|
||||
{
|
||||
get
|
||||
{
|
||||
return 2 * hossz * magassag + 2 * szelesseg * magassag;
|
||||
}
|
||||
}
|
||||
|
||||
public double mennyezet
|
||||
{
|
||||
get
|
||||
{
|
||||
return alapterulet;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Lakohelyiseg(double h, double sz, double m)
|
||||
{
|
||||
setHossz(h);
|
||||
setSzelesseg(sz);
|
||||
setMagassag(m);
|
||||
}
|
||||
|
||||
public void setHossz(double h)
|
||||
{
|
||||
hossz = h;
|
||||
}
|
||||
|
||||
public double getHossz()
|
||||
{
|
||||
return hossz;
|
||||
}
|
||||
|
||||
public void setSzelesseg(double sz)
|
||||
{
|
||||
szelesseg = sz;
|
||||
}
|
||||
|
||||
public double getSzelesseg()
|
||||
{
|
||||
return szelesseg;
|
||||
}
|
||||
|
||||
public void setMagassag(double m)
|
||||
{
|
||||
magassag = m;
|
||||
}
|
||||
|
||||
public double getMagassag()
|
||||
{
|
||||
return magassag;
|
||||
}
|
||||
|
||||
/*public void setHossz(double hl,bool lab)
|
||||
{
|
||||
hossz = hl * 0.33;
|
||||
}*/
|
||||
|
||||
|
||||
}
|
||||
}
|
15
EpuletProjekt/Program.cs
Normal file
15
EpuletProjekt/Program.cs
Normal file
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
|
||||
namespace EpuletProjekt
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Epulet ep = new Epulet();
|
||||
ep.beKeres();
|
||||
Console.WriteLine("Szükséges kő: "+ep.koNegyzetmeter);
|
||||
Console.WriteLine("Szükséges festék: "+ep.festekLiter(0.2));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -7,7 +7,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Szotar", "Szotar\Szotar.csp
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Valasztasok", "Valasztasok\Valasztasok.csproj", "{F70CD600-1632-4FB5-8DC0-BDD9DDF70248}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Oszto", "Oszto\Oszto.csproj", "{CCBC99D9-3207-4B83-80B7-382E0CE0E748}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Oszto", "Oszto\Oszto.csproj", "{CCBC99D9-3207-4B83-80B7-382E0CE0E748}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EpuletProjekt", "EpuletProjekt\EpuletProjekt.csproj", "{044AC2EB-56C3-4B85-869E-DCC63EEE3CD1}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
@ -27,6 +29,10 @@ Global
|
|||
{CCBC99D9-3207-4B83-80B7-382E0CE0E748}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CCBC99D9-3207-4B83-80B7-382E0CE0E748}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CCBC99D9-3207-4B83-80B7-382E0CE0E748}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{044AC2EB-56C3-4B85-869E-DCC63EEE3CD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{044AC2EB-56C3-4B85-869E-DCC63EEE3CD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{044AC2EB-56C3-4B85-869E-DCC63EEE3CD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{044AC2EB-56C3-4B85-869E-DCC63EEE3CD1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
Loading…
Reference in New Issue
Block a user