sync
This commit is contained in:
27
C/CS/Starter_assignment/Student.cs
Normal file
27
C/CS/Starter_assignment/Student.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
namespace Starter_assignment;
|
||||
|
||||
class Student {
|
||||
private string Name { get; }
|
||||
private int StudentNumber { get; }
|
||||
private string GroupName { get; }
|
||||
|
||||
public Student(string name, int studentNumber, string groupName) {
|
||||
if (string.IsNullOrWhiteSpace(name)) {
|
||||
throw new ArgumentException("Name cannot be empty.");
|
||||
}
|
||||
if (studentNumber < 10000 && studentNumber != -1) {
|
||||
throw new ArgumentException("Student number must be >= 10000 or -1.");
|
||||
}
|
||||
|
||||
Name = name;
|
||||
StudentNumber = studentNumber;
|
||||
GroupName = groupName;
|
||||
}
|
||||
|
||||
public int GetStudentNumber() {
|
||||
return StudentNumber;
|
||||
}
|
||||
public string GetInfo() {
|
||||
return $"{Name} ({StudentNumber}) - {GroupName}";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user