Exercises in this lecture   Go to the notes, in which this exercise belongs -- Keyboard shortcut: 'u'   Alphabetic index   Course home   

Exercise solution:
ECTS Grades


Here is my solution:

using System;

public enum ECTSGrade: sbyte     // signed byte
  {A = 12, B = 10, C = 7, D = 4, E = 2, Fx = 0, F = -3}


public class GradeExercise{

  public static void Main(){

    ECTSGrade g1 = (ECTSGrade)0,
              g2 = ECTSGrade.B;
  
    Console.WriteLine("Grade g1: {0}", g1);    // Fx
    Console.WriteLine("Grade g2: {0}", g2);    // B
    Console.WriteLine("Grade g2: {0}", g2+1);  // 11  -- not 12
  }
}