|
-
Nov 10th, 2002, 07:11 PM
#1
Thread Starter
New Member
Problems with the coding
Hello all
This is my EventList.cpp file and I need to code it. Below this are header files EventList.h and Date.h. I am new in this so could anyone help me with that. It is an event calendar...thanks
#include "EventList.h"
#include "Date.h"
EventList::EventList(Date d) {
// create an empty event list - set today's date
}
EventList::~EventList() {
// must go through all the events deleting them
}
Date EventList::getToday(){
// returns todays date
}
void EventList::setToday(Date d){
// sets todays date
}
void EventList::setNow(Clock c){
// sets the time
}
Clock EventList::getNow(){
// returns the time
}
bool EventList::addEvent(Event* e){
// takes an event pointer (event must have been created)
// and adds it to the event list at the next avilable
// place in the array - if there is one
}
bool EventList::delEvent(Event* e){
// loops through the array checking the event pointer parameter
// against the events in the array
// deletes it when they match
// consider moving down the later array elements to close the gap??
}
Event* EventList::findEvent(Date d, Clock c, Type type){
// loops through the eventlist array checking each event
// agains these parameters - if found return the event pointer
// if not return a null pointer (i.e. zero)
}
void EventList: rintByDate(Date d){
// print all events which have this date
}
void EventList: rintAll(){
// loop through the array of events printing each one
}
EventList.h
#ifndef EVENTLIST_H
#define EVENTLIST_H
#include "date.h"
#include "event.h"
#include <string>
using namespace std;
class EventList {
public:
EventList(Date d);
~EventList();
void setToday(Date d);
Date getToday();
void setNow(Clock c);
Clock getNow();
bool addEvent(Event* e);
bool delEvent(Event* e);
Event* findEvent(Date d, Clock c, Type type);
void printAll();
void printByDate(Date d);
private:
Date today;
Clock now;
/**
* @label allEvents
* @clientCardinality 1
* @supplierCardinality 0..n
*/
Event * allEvents[100];
};
#endif //EVENTLIST_
Date.H
#ifndef DATE_H
#define DATE_H
#include <iostream>
using namespace std;
// array of month ends as days of the year
// used to check validity of dates input
const int Monthends[] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304,
334, 365};
class Date {
private:
// private data
int day, month, year;
// a private function
int getmonth(int & ddyear); // returns month and day from day-of-year
char buffer[10]; // used for char output
public:
// constructors
Date();
Date(int dd, int mm, int yy);
Date(char* );
// access functions
void setDate(int dd, int mm, int yy);
int getDay();
int getMonth();
int getYear();
void operator=(Date d); // sets current date equal to parameter d
// combination functions
void incDate(long ndays); // sets current date to ndays ahead
Date operator+(long ndays); // returns date ndays ahead of current
int dayNumber(); // returns day in year of current date
long operator-(Date d); // returns the number of days between
// current date and parameter d
// comparisons
bool operator==(Date d); // checks equality
bool operator>(Date d); // greater than
bool operator<(Date d); // less than
// output
const char* c_str(); // write as character output
};
// utility functions - not actually part of the class
// overloaded operator<< function for Date class
// print as dd/mm/yyyy
ostream& operator<<(ostream& os,const Date d);
// overloaded operator>> function for Date class
// input a date as dd/mm/yyyy
istream& operator>>(istream& is, Date &d);
// get a Date from a text buffer
Date texttodate(const char* buffer);
// checks for leap year
int isleapyear(int yr);
#endif
-
Nov 10th, 2002, 07:38 PM
#2
Fanatic Member
I suggest you get a peice of paper, and do pseudocode for your functions.
No one is going to write the program for you
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Nov 11th, 2002, 08:58 AM
#3
I suggest you use the search function on this forum. There was something like this not long ago, something like "linked array".
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|