// Records the credits for each known course.
const CREDITS = {
    "CSE 341": 4,
    "CSE 344": 4,
    "CSE 421": 3,
    "CSE 431": 3,
    "CSE 444": 4,
  };


// Returns the total credits for the given list of classes. (The list should
// have no duplicates.)
export function TotalCredits(classes: string[]): number {
  let total : number = 0;
  for (let i = 0; i < classes.length; i++) {
    if (classes[i] in CREDITS) {
      total += CREDITS[classes[i]];
    } else {
      throw new Error("no such class: " + classes[i]);
    }
  }
  return total;
}