#ifndef GRADED_THINGS
#define GRADED_THINGS

#include <iostream.h>
#include <fstream.h>
#include <stddef.h>
#include "grades.h"

class gradedThing {
public:

  // reads the information about this gradedThing from the stream
  gradedThing(ifstream);
  // prompts the user for information about this gradedThing
  gradedThing();

  // returns the string in the name slot
  char* getName();
  // returns the short name..
  char* getShortName();
  // returns the weight
  int getWeight();
  
  // returns neg. if the shortname of this instance alphabetically
  // precedes the parameter, 0 if they are the same, pos if this
  // shortname comes after.
  // does a strcmp between the shortname and the string..
  int compareShortName(char*);
  
  friend float grade::weightedScore();
  
private:
  int weight;
  char shortName[4];
  char name[21];
};

class gradedThingElement;

// a list of gradedThings..  Your main should probably have an
// instance of this to keep track of all the gradedThings in the
// course.
class gradedThingList {
public:
  gradedThingList();
  ~gradedThingList();

  // Returns the number of elements in the list..
  int getSize();

  // Iteration methods.  these work the same as the iteration
  // methods on grade and student lists.  See fileio.c for an
  // example of how they are used.
  int empty();
  void reset();
  gradedThing* currentGradedThing(); 
  gradedThing* nextGradedThing();
  
  // Methods that add a new gradedThing to the list

  // adds an existing gradedThing to the list.  Always appends.
  // the paramter must point to an instance of gradedThing.
  // returns a pointer to the new gradedThign (the parameter)
  gradedThing* addGradedThing(gradedThing*);

  // creates a new gradedThing, with input from the file stream
  // and then adds it to the list.
  // returns a pointer to the new gradedThing
  gradedThing* addGradedThing(ifstream);

  // creates a new gradedThing, with input from the user
  // and then adds it to the list.
  // returns a pointer to the new gradedThing
  gradedThing* addGradedThing();
  
private: // BEWARE OF DOG
  int size;
  gradedThingElement* current;
  gradedThingElement* first;
  gradedThingElement* last;
};

// You shouldn't need to use this class
class gradedThingElement {
public:
  gradedThingElement(gradedThing*); // always append
  ~gradedThingElement();

  friend gradedThingList;

private:
  gradedThingElement* next;
  gradedThing* data;
};

#endif

