Large Project in Pieces

suggestions welcome

Page 1 of 1

11 Replies - 820 Views - Last Post: 10 November 2009 - 01:48 PM Rate Topic: -----

#1 cdarklight  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 70
  • Joined: 15-August 09

Large Project in Pieces

Post icon  Posted 09 November 2009 - 03:22 PM

I am building a project for class. I wouldn't even make it like this, but it's how the project progressed over the course. Now I have a bunch of pieces and some of them don't seem to fit. I am willing to tear my project to the ground if necessary.

1) Time class, no issues
#ifndef TIME_H
#define TIME_H
#include <iostream>
using std::ostream;

class Time
{
	friend ostream &operator<<( ostream &, const Time & );
public:
	Time(int = 0, int = 0, int = 0);
	Time operator++( int );			//postfix increment operator
	Time &operator++();				//prefix increment operator
	Time operator--( int );			//postfix decrement operator
	Time &operator--();				//prefix decrement operator
	Time operator+=(const Time &);	
	Time operator-=(const Time &);
protected:
	int hour, minute, second;
	void timeHelper();
	void simplify();
	void increment();				//increment function
	void decrement();				//decrement function
};

#endif


#include <iostream>
using std::cout;
using std::endl;

#include <iostream>
using std::ostream;

#include "Time.h"

// Constructor
Time::Time(int h, int m, int s)
{
	hour =  h;
	minute = m;
	second = s;
	timeHelper();
}

// Check for validity of numbers
void Time::timeHelper()
{
	if(minute < 0 || minute > 60)
	{
		minute = 0;
		cout << "Error: Invalid Minute detected.\nFixing...\n\nNote: There may be a discrepency." << endl;
	}
	if(second < 0 || second > 60)
	{
		second = 0;
		cout << "Error: Invalid Second detected.\nFixing...\n\nNote: There may be a discrepency." << endl;
	}
	if(hour < 0)
	{
		hour = 0;
		cout << "Error: Invalid hour detected.\nFixing...\n\nNote: There may be a discrepency." << endl;
	}
}

// increment function for ++ prefix and postfix
void Time::increment()
{
	second++;
	simplify();
}

// prefix incrementer
Time &Time::operator ++()
{
	increment();

	return *this;
}

// postfix incrementer
Time Time::operator ++( int )
{
	Time temp = *this;
	increment();

	return temp;
}

// increment function for ++ prefix and postfix
void Time::decrement()
{
	second--;
	simplify();
}

// prefix decrementor
Time &Time::operator --()
{
	decrement();

	return *this;
}

// postfix decrementor
Time Time::operator --( int )
{
	Time temp = *this;
	decrement();

	return temp;
}

Time Time::operator+=(const Time &p)
{
	this->hour += p.hour;
	this->minute += p.minute;
	this->second += p.second;
	simplify();
	return *this;
}

Time Time::operator-=(const Time &m)
{
	this->hour -= m.hour;
	this->minute -= m.minute;
	this->second -= m.second;
	simplify();
	return *this;
}

void Time::simplify()
{
	while( second <= 00 )
	{
		second += 60;
		minute--;
		while( minute <= 00 )
		{
			minute += 60;
			hour--;
		}
		if( hour < 0 ) hour += 24;
	}
	while( second >= 60 )
	{
		second -= 60;
		minute++;
		while( minute >= 60 )
		{
			minute -= 60;
			hour++;
		}
		if( hour >= 24 ) hour -= 24;
	}
	timeHelper();
}

ostream &operator<<( ostream &output, const Time &d )
{
	cout << d.hour << ":" << d.minute << ":" << d.second;
	return output;
}



2- abstract classes, no issues here, i think
#include <string>
using std::string;

class CallParticipant
{
public:
	virtual int getMultiplier() const = 0;
	virtual string getType() const = 0;
};

#endif


class SupportPerson : public CallParticipant
{
public:
	virtual int getMultiplier() const = 0;
	virtual string getType() const = 0;
};


class Expert : public SupportPerson
{
public:
	Expert( int = 1 );
	int getMultiplier() const;
	string getType() const { return "Expert"; }
protected:
	int multiplier;
};


Expert::Expert( int m )
{
	if( m <= 1 )
		multiplier = 1;
	else
		multiplier = m;
}

int Expert::getMultiplier() const { return multiplier; }


class StandardSP : public SupportPerson
{
public:
	StandardSP( int = 1 );
	int getMultiplier() const;
	string getType() const { return "Standard Training"; }
protected:
	int multiplier;
};

StandardSP::StandardSP( int m )
{
	if( m <= 1 )
		multiplier = 1;
	else
		multiplier = m;
}

int StandardSP::getMultiplier() const { return ( multiplier * 2 ); }


class Novice : public SupportPerson
{
public:
	Novice( int = 1 );
	int getMultiplier() const;
	virtual string getType() const { return "Novice"; }
protected:
	int multiplier;
};


Novice::Novice( int m )
{
	if( m <= 1 )
		multiplier = 1;
	else
		multiplier = m;
}

int Novice::getMultiplier() const { return ( multiplier * 3 ); }


class Caller : public CallParticipant
{
public:
	Time getHoldTime() const;
	void setHoldTime( Time );
	Time getCallTime() const;
	void setCallTime( Time );
	virtual int getMultiplier() const = 0;
	virtual string getType() const = 0;
protected:
	Time holdTime;
	Time callTime;
};


Time Caller::getHoldTime() const { return holdTime; }

void Caller::setHoldTime( Time h ){ holdTime = h; }

Time Caller::getCallTime() const { return callTime; }

void Caller::setCallTime( Time c ){ callTime = c; }


class Easy : public Caller
{
public:
	Easy(int = 1);
	int getMultiplier() const;
	string getType() const {return "Easy to deal with";}
protected:
	int multiplier;
};

Easy::Easy( int m )
{
	if( m <= 1 )
		multiplier = 1;
	else
		multiplier = m;
}

int Easy::getMultiplier() const { return multiplier; }


class Average : public Caller
{
public:
	Average(int = 1);
	int getMultiplier() const;
	string getType() const {return "Average Caller";}
protected:
	int multiplier;
};


Average::Average( int m )
{
	if( m <= 1 )
		multiplier = 1;
	else
		multiplier = m;
}

int Average::getMultiplier() const { return ( multiplier * 2 ); }

class Difficult : public Caller
{
public:
	Difficult(int = 1);
	int getMultiplier() const;
	string getType() const {return "Difficult Caller";}
protected:
	int multiplier;
};


Difficult::Difficult( int m )
{
	if( m <= 1 )
		multiplier = 1;
	else
		multiplier = m;
}

int Difficult::getMultiplier() const { return ( multiplier * 3 ); }



3- class templates, worked ok
template< class c, class a > // caller, answerer
class Call
{
	friend CallQueue:
public:
	Call( c, a );
	Time getCallTime();
	void incrementTime(){ callTime++; }
	void SaveCall();
protected:
	c  currentCaller;
	a currentSP;
	Time callTime;
	Call *nxt;
};


#include "Call.h"
#include "Caller.h"
#include "SupportPerson.h"
#include "Time.h"
#include <iostream>
#include <string>
using std::string;
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
using std::ios;
#include <fstream>
using std::fstream;

template< class c, class a >
Call<c,a>::Call( c mycaller, a mySP )
{
	currentCaller = mycaller;
	currentSP = mySP;
	callTime(0, 0, 0);
}

template< class c, class a >
Time Call<c,a>::getCallTime()
{
	int added;
	added = (currentCaller.getMultiplier()) + (currentSP.getMultiplier());
	callTime += added;

	return callTime;
}

template< class c, class a >
void Call<c,a>::SaveCall()
{
   fstream file( "Calls.dat", ios::app );
   
   if ( !file ) 
   {
	  cout << "File could not be opened." << endl;
	  exit( 1 );
   }

   // position at end of fileObject
   file.seekg( 0, ios::end );
   outClientFile << currentCaller.getType() << ' ' << currentSP.getType() << ' ' << callTime << endl;
   
   file.close;
}




4- was to add the SaveCall() function to part 3 above
5- Reports class, I'll come back to this when I have more functionality in my program.
6- CallQueue, made Call self-referencing and CallQueue a friend. The class gives the following code:
ifndef LIST_H
#define LIST_H

#include <iostream>
using std::cout;

#include "Listnode.h" // ListNode class definition

template< typename NODETYPE >
class List 
{
public:
   List(); // constructor
   ~List(); // destructor
   void insertAtFront( const NODETYPE & );
   void insertAtBack( const NODETYPE & );
   bool removeFromFront( NODETYPE & );
   bool removeFromBack( NODETYPE & );
   bool isEmpty() const;
   void print() const;
protected:
   ListNode< NODETYPE > *firstPtr; // pointer to first node
   ListNode< NODETYPE > *lastPtr; // pointer to last node

   // utility function to allocate new node
   ListNode< NODETYPE > *getNewNode( const NODETYPE & );
}; // end class List

// default constructor
template< typename NODETYPE >
List< NODETYPE >::List() 
   : firstPtr( 0 ), lastPtr( 0 ) 
{ 
   // empty body
} // end List constructor

// destructor
template< typename NODETYPE >
List< NODETYPE >::~List()
{
   if ( !isEmpty() ) // List is not empty
   {	
	  cout << "Destroying nodes ...\n";

	  ListNode< NODETYPE > *currentPtr = firstPtr;
	  ListNode< NODETYPE > *tempPtr;

	  while ( currentPtr != 0 ) // delete remaining nodes
	  {  
		 tempPtr = currentPtr;
		 cout << tempPtr->data << '\n';
		 currentPtr = currentPtr->nextPtr;
		 delete tempPtr;
	  } // end while
   } // end if

   cout << "All nodes destroyed\n\n";
} // end List destructor

// insert node at front of list
template< typename NODETYPE >
void List< NODETYPE >::insertAtFront( const NODETYPE &value )
{
   ListNode< NODETYPE > *newPtr = getNewNode( value ); // new node

   if ( isEmpty() ) // List is empty
	  firstPtr = lastPtr = newPtr; // new list has only one node
   else // List is not empty
   {
	  newPtr->nextPtr = firstPtr; // point new node to previous 1st node
	  firstPtr = newPtr; // aim firstPtr at new node
   } // end else
} // end function insertAtFront

// insert node at back of list
template< typename NODETYPE >
void List< NODETYPE >::insertAtBack( const NODETYPE &value )
{
   ListNode< NODETYPE > *newPtr = getNewNode( value ); // new node

   if ( isEmpty() ) // List is empty
	  firstPtr = lastPtr = newPtr; // new list has only one node
   else // List is not empty
   {
	  lastPtr->nextPtr = newPtr; // update previous last node
	  lastPtr = newPtr; // new last node
   } // end else
} // end function insertAtBack

// delete node from front of list
template< typename NODETYPE >
bool List< NODETYPE >::removeFromFront( NODETYPE &value )
{
   if ( isEmpty() ) // List is empty
	  return false; // delete unsuccessful
   else 
   {
	  ListNode< NODETYPE > *tempPtr = firstPtr; // hold tempPtr to delete

	  if ( firstPtr == lastPtr )
		 firstPtr = lastPtr = 0; // no nodes remain after removal
	  else
		 firstPtr = firstPtr->nextPtr; // point to previous 2nd node

	  value = tempPtr->data; // return data being removed
	  delete tempPtr; // reclaim previous front node
	  return true; // delete successful
   } // end else
} // end function removeFromFront

// delete node from back of list
template< typename NODETYPE >
bool List< NODETYPE >::removeFromBack( NODETYPE &value )
{
   if ( isEmpty() ) // List is empty
	  return false; // delete unsuccessful
   else 
   {
	  ListNode< NODETYPE > *tempPtr = lastPtr; // hold tempPtr to delete

	  if ( firstPtr == lastPtr ) // List has one element
		 firstPtr = lastPtr = 0; // no nodes remain after removal
	  else 
	  {
		 ListNode< NODETYPE > *currentPtr = firstPtr;

		 // locate second-to-last element			
		 while ( currentPtr->nextPtr != lastPtr )	
			currentPtr = currentPtr->nextPtr; // move to next node

		 lastPtr = currentPtr; // remove last node
		 currentPtr->nextPtr = 0; // this is now the last node
	  } // end else

	  value = tempPtr->data; // return value from old last node
	  delete tempPtr; // reclaim former last node
	  return true; // delete successful
   } // end else
} // end function removeFromBack

// is List empty?
template< typename NODETYPE > 
bool List< NODETYPE >::isEmpty() const 
{ 
   return firstPtr == 0; 
} // end function isEmpty

// return pointer to newly allocated node
template< typename NODETYPE >
ListNode< NODETYPE > *List< NODETYPE >::getNewNode( 
   const NODETYPE &value )
{
   return new ListNode< NODETYPE >( value );
} // end function getNewNode

// display contents of List
template< typename NODETYPE >
void List< NODETYPE >::print() const
{
   if ( isEmpty() ) // List is empty
   {
	  cout << "The list is empty\n\n";
	  return;
   } // end if

   ListNode< NODETYPE > *currentPtr = firstPtr;

   cout << "The list is: ";

   while ( currentPtr != 0 ) // get element data
   {
	  cout << currentPtr->data << ' ';
	  currentPtr = currentPtr->nextPtr;
   } // end while

   cout << "\n\n";
} // end function print

#endif



#include "List.h" 
template< typename QUEUETYPE >
class CallQueue : private List< QUEUETYPE >
{
public:
	void enqueue( const QUEUETYPE &data )
	{
	insertAtBack( data );
	} 
	
	bool dequeue( QUEUETYPE &data )
	{
		return removeFromFront( data );
	} 

	bool isQueueEmpty() const
	{
		return isEmpty();
	}

	void printQueue() const
	{
		print();
	} 
};


7-Call generator, for atoi, easy
#include <string>
using std::string;
#include "LiveCall.h"

class CallGenerator
{
public:
	void setMin( string ); // minCall
	void setMax( string ); // maxCall
	void setDif( string ); // difPerc
	void setEC( string );  // easyCall
	void setDC( string );  // difCall
	void setNS( string );  // novSup
	void setES( string );  // ExpSup
	void setTS( string );  // totalSup
	int getMin(){ return minCall; }
	int getMax(){ return maxCall; }
	int getDif(){ return difPerc; }
	int getEC(){ return easyCall; }
	int getDC(){ return difCall; }
	int getNS(){ return novSup; }
	int getES(){ return expSup; }
	int getTS(){ return totalSup; }
	LiveCall getLive();
protected:
	int minCall,	// Least calls per minute: pos int
		maxCall,	// Most calls per minute: pos int
		difPerc,	// Percent difficult problems: 1-100
		easyCall,	// Percent easy callers: 1-100
		difCall,	// Percent difficult callers: 1-100
		novSup,		// Percent novice support: 1-100
		expSup,		// Percent expert support: 1-100
		totalSup;	// Number of support people: pos int
};

void CallGenerator::setMin( string input )
{
	if( input.find_first_not_of("1234567890" ) != -1 )
		cout << "Invalid Input. Must be a number.";
	int num = atoi( input.c_str() );
	
	if( num < 0 )
		cout << "Invalid Number. Must be a positive integer.";
	else
		minCall = num;	
}

void CallGenerator::setMax( string input )
{
	if( input.find_first_not_of("1234567890" ) != -1 )
		cout << "Invalid Input. Must be a number.";
	int num = atoi( input.c_str() );
	
	if( num < 0 )
		cout << "Invalid Number. Must be a positive integer.";
	else if( num < minCall )
		cout << "Max cannot be smaller than Min.";
	else
		maxCall = num;
}

void CallGenerator::setDif( string input )
{
	int num;
	int loc = input.find_first_not_of("1234567890" );
	if( loc != -1 )
		input = input.substr(0,loc);
	if( input.empty() )
		cout << "Invalid entry. Must be a number 1-100 for percentage.";
	else
	{
		num = atoi( input.c_str() );
		if( num < 1 || num > 100 )
			cout << "Invalid entry. Must be a number 1-100 for percentage.";
		else
			difPerc = num;
	}
}

void CallGenerator::setEC( string input )
{
	int num;
	int loc = input.find_first_not_of("1234567890" );
	if( loc != -1 )
		input = input.substr(0,loc);
	if( input.empty() )
		cout << "Invalid entry. Must be a number 1-100 for percentage.";
	else
	{
		num = atoi( input.c_str() );
		if( num < 1 || num > 100 )
			cout << "Invalid entry. Must be a number 1-100 for percentage.";
		else
			easyCall = num;
	}
} 
void CallGenerator::setDC( string input )
{
	int num;
	int loc = input.find_first_not_of("1234567890" );
	if( loc != -1 )
		input = input.substr(0,loc);
	if( input.empty() )
		cout << "Invalid entry. Must be a number 1-100 for percentage.";
	else
	{
		num = atoi( input.c_str() );
		if( num < 1 || num > 100 )
			cout << "Invalid entry. Must be a number 1-100 for percentage.";
		else if( (num + easyCall) > 100 )
			cout << "Total percentage cannot be greater than 100.";
		else
			difCall = num;
	}
} 

void CallGenerator::setNS( string input )
{
	int num;
	int loc = input.find_first_not_of("1234567890" );
	if( loc != -1 )
		input = input.substr(0,loc);
	if( input.empty() )
		cout << "Invalid entry. Must be a number 1-100 for percentage.";
	else
	{
		num = atoi( input.c_str() );
		if( num < 1 || num > 100 )
			cout << "Invalid entry. Must be a number 1-100 for percentage.";
		else
			novSup = num;
	}
} 

void CallGenerator::setES( string input )
{
	int num;
	int loc = input.find_first_not_of("1234567890" );
	if( loc != -1 )
		input = input.substr(0,loc);
	if( input.empty() )
		cout << "Invalid entry. Must be a number 1-100 for percentage.";
	else
	{
		num = atoi( input.c_str() );
		if( num < 1 || num > 100 )
			cout << "Invalid entry. Must be a number 1-100 for percentage.";
		else if( (num + novSup) > 100 )
			cout << "Total percentage cannot be greater than 100.";
		else
			expSup = num;
	}
}

void CallGenerator::setTS( string input )
{
	if( input.find_first_not_of("1234567890" ) != -1 )
		cout << "Invalid Input. Must be a number.";
	int num = atoi( input.c_str() );
	
	if( num < 0 )
		cout << "Invalid Number. Must be a positive integer.";
	else
		totalSup = num;	
}

LiveCall CallGenerator::getLive()
{
	LiveCall currentCall;

}


8-Everything is to come together, but all hell breaks loose and nothing seems right
-a - LiveCall class
class LiveCall
{
public:
	LiveCall(){}
	Time getHoldTime(){ return holdTime; }
	Time getCallTime(){ return callTime; }
	void setNumMinutes( int s ){ s = numMinutes; }
	void incrementHoldTime(){ holdTime += 60; }
	void incrementCallTime(){ callTime += 60; }
	bool isCallDone(){ return ( numMinutes <= minutesPassed ); }
	void saveCall();
protected:
	Time holdTime,
		 callTime;
	int numMinutes,
		minutesPassed;
};

#include "LiveCall.h"
#include "Time.h"
#include <iostream>
using std::cout;
using std::endl;
using std::ios;
#include <fstream>
using std::fstream;

void LiveCall::saveCall()
{
   fstream file( "LiveCalls.dat", ios::app );
   
   if ( !file ) 
   {
	  cout << "File could not be opened." << endl;
	  exit( 1 );
   }

   // position at end of fileObject
   file.seekg( 0, ios::end );

   file << holdTime << ' ' << callTime << endl;
   
   file.close;
}



-b-Add LiveCall to CallGenerator, ummm....
-c-CallManager class using STL
With my LiveCall or CallGenerator causing me grief with it's vagaries and lack of detail, I didn't really know how to handle this.
#include "LiveCall.h"
#include <queue>

class CallManager
{
public:
//	AddCall;
//	AnswerCall;
//	IncrementHoldTime;
//	IncrementCallTime;
//	EndCall;
protected:
	queue<LiveCall> holdQueue;
	queue<LiveCall> inProcessQueue;

};


-d- Driver
#include <iostream>
using std::cout;
using std::cin;
using std::endl;

#include <vector>
using std::vector;

#include <string>
using std::string;
using std::getline;

// Time class
#include "Time.h"

// Callers
#include "Easy.h"
#include "Average.h"
#include "Difficult.h"

// Support
#include "Expert.h"
#include "StandardSP.h"
#include "Novice.h"

// Call template class and generator
#include "Call.h"
#include "CallGenerator.h"

int main()
{
	CallGenerator holding;
	string input;

	cout << "Please enter the following parameters:\nLeast calls per minute: ";
	getline( cin, input );
	holding.setMin( input );

	cout << "Most calls per minute: ";
	getline( cin, input );
	holding.setMax(input);

	cout << "Percent difficult problems: ";
	getline( cin, input );
	holding.setDif( input );

	cout << "Percent easy callers: ";
	getline( cin, input );
	holding.setEC( input );

	cout << "Percent difficult callers: ";
	getline( cin, input );
	holding.setDC( input );

	cout << "Percent novice support personnel: ";
	getline( cin, input );
	holding.setNS( input );

	cout << "Percent expert support personnel: ";
	getline( cin, input );
	holding.setES( input );

	cout << "Number of support people: ";
	getline( cin, input );
	holding.setTS( input );

	for( int i = 0; i < 360; i++ )
	{
		if(( i % 10 )== 0 )
			// generate new call values with CallGenerator

		// Add number of calls from CallManager to queue
		// Use CallManager to increment hold times and call times
		// 'answer' calls if support is available
		// End calls and 'release' support for next loop

	}
	
	return 0;
}



Now all the effort that has gone into this, it's all junk because it doesn't fit together very well. I'm not asking for you to finish it for me; I'm looking for guidance on how to work with this and maybe a pointer on what i could do with it.

If anyone is willing to work with me, I highly appreciate everything.
Thank you

This post has been edited by cdarklight: 09 November 2009 - 03:25 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Large Project in Pieces

#2 jjl  Icon User is offline

  • Engineer
  • member icon

Reputation: 1074
  • View blog
  • Posts: 4,533
  • Joined: 09-June 09

Re: Large Project in Pieces

Posted 09 November 2009 - 03:29 PM

OMG ... well do you have an actual problem. My finger got a cramp from scrolling while trying to read all of your code
Was This Post Helpful? 0
  • +
  • -

#3 cdarklight  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 70
  • Joined: 15-August 09

Re: Large Project in Pieces

Posted 09 November 2009 - 03:42 PM

I'm so lost, I really don't know what question(s) would benefit me to know the answer of.
I had parts 1-4 and part 7 working individually with driver programs as the requirements of the project requested.
Part 5 I have little interest in because it affects the overall program very little and is only 1% of the overall grade.

I think the place my project explodes into a dying mess is parts 6 and 8b.
Part 6, I just don't see how it fits in once things start coming together. There are two other queues in CallManager (part 8c) that seem to do everything needed for queues. And how would I loop through a queue to call the same function in each element without messing up the queue (incrementTime)?

I'm in the IRC if you want to give me direct advice too...

This post has been edited by cdarklight: 09 November 2009 - 03:55 PM

Was This Post Helpful? 0
  • +
  • -

#4 Oler1s  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1395
  • View blog
  • Posts: 3,884
  • Joined: 04-June 09

Re: Large Project in Pieces

Posted 09 November 2009 - 03:59 PM

What is the high level logic of your program? You have all these pieces of code, but I don't get what you want your program to actually do.
Was This Post Helpful? 0
  • +
  • -

#5 cdarklight  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 70
  • Joined: 15-August 09

Re: Large Project in Pieces

Posted 09 November 2009 - 04:06 PM

the description reads:
A program for simulation of call traffic between call center workers. Estimate hold time and call time for callers based on specific conditions( number of calls per minute, problem complexity, caller type, support type, personnel number)
values are generated but allows the user to define thresholds. Number of calls per minute will be changed every 10 minutes. Complexity of the problem, support type and caller type will vary for each call.
There are a few comments in the driver program at the end of part 8.
Like I said previously, if it was up to me, it wouldn't even be structured like this.

This post has been edited by cdarklight: 09 November 2009 - 04:06 PM

Was This Post Helpful? 0
  • +
  • -

#6 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5822
  • View blog
  • Posts: 12,675
  • Joined: 16-October 07

Re: Large Project in Pieces

Posted 09 November 2009 - 06:04 PM

You are defining a template:
template< class c, class a > // caller, answerer
class Call



But assuming type characteristics:
added = (currentCaller.getMultiplier()) + (currentSP.getMultiplier());
outClientFile << currentCaller.getType() << ' ' << currentSP.getType() << ' ' << callTime << endl;



I believe you don't want a template at all:
class Call {
	friend CallQueue:
public:
	Call(Caller c, SupportPerson a) : currentCaller©, currentSP(a), callTime(Time(0, 0, 0)) { }
	Time getCallTime() {
		callTime += (currentCaller.getMultiplier()) + (currentSP.getMultiplier())
		return callTime;
	}
	void incrementTime(){ callTime++; }
	void SaveCall();
protected:
	Caller currentCaller;
	SupportPerson currentSP;
	Time callTime;
	Call *nxt;
};



You implement a List and Queue? Give them up, just use the STL versions. Which you appear to do later, anyway.

Your CallGenerator uses the exact same code over and over. Make a method.

The SupportPerson class is doing nothing for you; at all. But it could, and simplify a block of code:
class SupportPerson : public CallParticipant {
public:
	virtual int getMultiplier() const;
	virtual string getType() const;
protected:
	string typeString;
	SupportPerson(const string &type, int mod, int multi=1);
	int multiplier, modifier;
	
};

SupportPerson::SupportPerson(const string &type, int mod, int multi) : typeString(type), modifier(mod), multiplier(multi) {
	if (multiplier<1) { multiplier = 1; }
}
int SupportPerson::getMultiplier() const { return multiplier * modifier; }
string SupportPerson::getType() const { return typeString; }


class Expert : public SupportPerson {
public:
	Expert(int multi=1) : SupportPerson("Expert", 1, multi) {}
};

class StandardSP : public SupportPerson {
public:
	StandardSP(int multi=1) : SupportPerson("Standard Training", 2, multi) {}
};

class Novice : public SupportPerson {
public:
	Novice(int multi=1) : SupportPerson("Novice", 2, multi) {}
};



That's all I got right now. This is a butt load of code and I can't really see where you're going with it.
Was This Post Helpful? 0
  • +
  • -

#7 Oler1s  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1395
  • View blog
  • Posts: 3,884
  • Joined: 04-June 09

Re: Large Project in Pieces

Posted 09 November 2009 - 06:12 PM

Quote

the description reads:
I wasn't asking for the description of the assignment. I was asking for your high level logic. To accomplish all or part of however much of the above program you want to do right now, you need some series of instructions. I want to know what the big picture logic is. Here's an example: Problem: Find the average of a list of numbers in a file. That's not the high level logic. That's a problem, a catalyst for a computer program.

My high level logic might be something like: 1) Acquire name of file 2) Read and store each number in file. 3) Sum up all numbers in file. 4) Divide sum by count of numbers. 5) Output to console the above calculation, which is called the average.

Those are a series of step by step tasks that provide a solution to the above problem. That's high level logic because it says nothing about what code to write, and in fact, each step might be pretty complicated. But it gets the big picture across. I want to know what your high level logic is right now.

You should know. That's because it's very hard to write a program to do something, when you don't know what you want the program to do.
Was This Post Helpful? 0
  • +
  • -

#8 cdarklight  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 70
  • Joined: 15-August 09

Re: Large Project in Pieces

Posted 09 November 2009 - 06:31 PM

http://www.jamesorav...T217Project.pdf
Was This Post Helpful? 0
  • +
  • -

#9 Joesavage1  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 90
  • Joined: 20-July 09

Re: Large Project in Pieces

Posted 10 November 2009 - 12:29 AM

View Postcdarklight, on 9 Nov, 2009 - 05:31 PM, said:



No offence here, as I dont understand this complicated C++. But to me it looks like your almost getting the people at dream in code to do this all for you. And from my understanding and experiance I belive dream in code is ment to help you, and not to do it all for you.


Sorry if this is a misunderstanding,

Its just the way it looks to me,


Regards,


Joe
Was This Post Helpful? 0
  • +
  • -

#10 Oler1s  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1395
  • View blog
  • Posts: 3,884
  • Joined: 04-June 09

Re: Large Project in Pieces

Posted 10 November 2009 - 01:05 AM

cdarklight, you are making it impossible for anyone to help you. Step back and look at what you are doing. You post some code here. You post the assignment here that motivates writing the code. Then you say "I don't know what to do".

Where are we supposed to go from here? You have an assignment. Are you having trouble doing something specific with the assignment? If you vocalizing your problem is as simple as repeating something in the assignment, then so be it. But as long as you don't specify it, no one here can help you.

More to the point, if you can't yourself identify "the next step", no wonder you are stuck. You don't know what to do because you haven't determined what your next goal is.
Was This Post Helpful? 0
  • +
  • -

#11 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon

Reputation: 5822
  • View blog
  • Posts: 12,675
  • Joined: 16-October 07

Re: Large Project in Pieces

Posted 10 November 2009 - 05:33 AM

It looks like it's pretty much spelled out for you then. And you have seem to have done little more than the paint by numbers of the specification.

I'd note that the UML design is poor, needing only two classes and apparently not really using inheritance at all, in spite of all the verbiage. Even if you really wanted all those classes, not moving standard methods up into the base is a novice fail.
Was This Post Helpful? 0
  • +
  • -

#12 cdarklight  Icon User is offline

  • D.I.C Head

Reputation: 4
  • View blog
  • Posts: 70
  • Joined: 15-August 09

Re: Large Project in Pieces

Posted 10 November 2009 - 01:48 PM

Im sorry. It seems I have upset some people and others are saying I have everything I need. I do have all the pieces. My issue is I don't know where each piece goes in the overall puzzle. It is not my way of programming and I cannot figure it out.
I have decided to ditch parts 7 and 8 and mimic the functionality in a different manner than what is asked of me by the school.
The biggest issue for me in this is that the pieces were all created separately. I am now working from the top down into the program one piece at a time putting the pieces in as needed. There are even a couple that I have found are completely unnecessary. This does bother me a little, but I am accomplishing the end goal.

I want to thank each of you that have looked into this for me and apologize to those I have frustrated.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1