-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudent.cs
More file actions
41 lines (35 loc) · 984 Bytes
/
Student.cs
File metadata and controls
41 lines (35 loc) · 984 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Student_Records
{
public class Student
{
public int Number { get; private set; }
public string firstName { get; private set; }
public string lastName { get; private set; }
public DateTime DateOfBirth { get; private set; }
public char grade { get; set; }
public Student(int number, string first, string last, DateTime date)
{
Number = number;
firstName = first;
lastName = last;
DateOfBirth = date;
}
public static void Output(Student st)
{
Console.WriteLine(Convert.ToString(st.Number) + "\t" + st.firstName + "\t" + st.lastName + "\t" + st.DateOfBirth + "\t" + st.grade);
}
public string ConvertToString()
{
return Number.ToString()+firstName+lastName+DateOfBirth+grade.ToString();
}
public bool IsOverAge(int requiredAge)
{
return DateOfBirth.AddYears(requiredAge) <= DateTime.Today;
}
}
}