public override string ToString() { string Output = $"{FirstName} {LastName} {SoonerID}"; if (IsONProbation = true) { Output += " is on probation. \n"; } else { Output += " is not on probation. \n"; } Output += $"They have a {GPA.ToString("N2")} GPA and they owe {BursarBalance.ToString("C2")}"; return(base.ToString()); }
public override string ToString() { string result = $"{FirstName} {LastName} ({SoonerID}) has s {GPA.ToString("N2")} GPA and owes {BursarBalance.ToString("C")}"; if (IsOnProbation == true) { result += "\n Is on Probation."; } else { result += "\n Is not on Probation."; } return(result); }
// <summary> Creates a string representation of our class public override string ToString() { string output = $"{FirstName} {LastName}"; if (IsOnProbation == true) { output += "is on probation"; } else { output += "is not on probation"; } output += $"They have a {GPA.ToString("N2")} GPA +" + $"and they owe {BursarBalance.ToString("C2")}"; return(output); }
public IEnumerable <ValidationResult> Validate(ValidationContext validationContext) { List <ValidationResult> errors = new List <ValidationResult>(); if (string.IsNullOrEmpty(FirstName)) { errors.Add(new ValidationResult("The First Name field is required.", new[] { "FirstName" })); } if (string.IsNullOrEmpty(LastName)) { errors.Add(new ValidationResult("The Last Name field is required.", new[] { "LastName" })); } if (string.IsNullOrEmpty(GPA.ToString()) || GPA > 5 || GPA < 0) { errors.Add(new ValidationResult("You must enter a GPA between 0 and 5.", new[] { "GPA" })); } if (string.IsNullOrEmpty(Major.ToString())) { errors.Add(new ValidationResult("The Major field is required.", new[] { "Major" })); } return(errors); }