Oplossing opgave 3

Main (Program.cs)

Console.WriteLine("Rise and shine");
Console.WriteLine($"Het is nu {DateTime.Now.Hour}:{DateTime.Now.Minute}");
var log = QalAnalyzer.CreateDiary();
QalAnalyzer.AnalyseDiary(log);

QalAnalyzer.SummariseDiary(log);

Console.WriteLine("Dagboek wegschrijven?(j/n");
string csv = Console.ReadLine();
if(csv=="j")
{
    Console.WriteLine("Geef bestandsnaam");
    string nm = Console.ReadLine();
    QalAnalyzer.WriteDiary(log,nm);
}

DagboekEntry Klasse

class DagboekEntry
{
    public DagboekEntry()
    {
        ResetEntry();
    }
    public DagboekEntry(int qin, bool isinspin, bool isprivin, string descin)
    {
        Qal = qin;
        IsInspired = isinspin;
        IsPrivate = isprivin;
        Description = descin;
    }
    public bool IsInspired { get; set; }
    private string description;

    public string Description
    {
        get
        {
            if (isPrivate)
                return "***PRIVATE***";
            else return description;
        }
        set
        {
            description = value;
        }
    }

    private int qal;

    public int Qal
    {
        get { return qal; }
        set
        {
            if (value >= 0 && value <= 100)

                qal = value;
            else if (value < 0)
                qal = 0;
            else if (value > 100)
                qal = 100;
        }
    }
    private bool isPrivate = false;
    public void MakePrivate(bool goprivate)
    {
        IsPrivate = goprivate;
    }

    public bool IsPrivate
    {
        get { return isPrivate; }
        private set { isPrivate = value; }
    }
    public void ResetEntry()
    {
        isPrivate = false;
        qal = 50;
        description = "";
    }

    public void ShowLog()
    {
        Console.WriteLine("********");
        Console.WriteLine("ENTRY:");
        Console.WriteLine(Description);
        Console.WriteLine("QaL=" + qal);
        Console.WriteLine("********");
    }

}

QalAnalyzer Klasse

Last updated

Was this helpful?