solved fordulo_2 feladat_1
This commit is contained in:
49
fordulo_2/Program/Idopont.cs
Normal file
49
fordulo_2/Program/Idopont.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Program
|
||||
{
|
||||
class Idopont
|
||||
{
|
||||
public int Ora { get; set; }
|
||||
public int Perc { get; set; }
|
||||
public string Name { get; set; }
|
||||
|
||||
public Double Angle { get; set; }
|
||||
|
||||
public Idopont(int ora, int perc)
|
||||
{
|
||||
Ora = ora;
|
||||
Perc = perc;
|
||||
|
||||
Name = ReturnFormattedTime();
|
||||
|
||||
if (Ora >= 12)
|
||||
{
|
||||
Ora -= 12;
|
||||
}
|
||||
|
||||
}
|
||||
public string ReturnFormattedTime()
|
||||
{
|
||||
return string.Format("{0}:{1}", Ora, Perc);
|
||||
}
|
||||
|
||||
public double ClockAngle()
|
||||
{
|
||||
double angle = 0;
|
||||
angle = Math.Abs(Ora * 30 + Perc * 0.5 - Perc * 6);
|
||||
if (angle > 180)
|
||||
{
|
||||
angle = 360 - angle;
|
||||
}
|
||||
|
||||
Angle = angle;
|
||||
|
||||
return angle;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user