Please send questions to st10@humboldt.edu .
#include <iostream>
#include "sumCosts.h"
using namespace std;

//**************************************************
// Contract: main : void -> int
// Purpose: compare/test sumCostsI and sumCostsR on
//          a couple of linked lists of MyNodes
//
// Examples: not really applicable; simply runs
//           the functions on several hard-coded
//           lists and prints the results
//
// by: Sharon M. Tuttle
// last modified: 11-17-03
//***************************************************

int main()
{
    MyNodePtr emptyList;
    MyNodePtr newNodePtr, headPtr;

    // do both work properly on an empty list?
    emptyList = NULL;
    cout << "sumCostsI(emptyList) should be 0: "
         << sumCostsI(emptyList) << endl;
    cout << "sumCostsR(emptyList) should be 0: "
         << sumCostsR(emptyList) << endl;

    // how about the Examples-described list in
    //    the 2 functions? (building from last to first)
    headPtr = NULL;

    newNodePtr = new MyNode(4, 1.13);
    headPtr = newNodePtr;

    newNodePtr = new MyNode(3, 0.50);
    newNodePtr->set_nextPtr(headPtr);
    headPtr = newNodePtr;

    newNodePtr = new MyNode(2, 2.30);
    newNodePtr->set_nextPtr(headPtr);
    headPtr = newNodePtr;

    newNodePtr = new MyNode(1, 1.50);
    newNodePtr->set_nextPtr(headPtr);
    headPtr = newNodePtr;

    // NOW can run test...!  
    cout << endl;  
    cout << "sumCostsI(headPtr) should be 5.43: "
         << sumCostsI(headPtr) << endl;
    cout << "sumCostsR(headPtr) should be 5.43: "
         << sumCostsR(headPtr) << endl;

    return 0;
}