Click here to Skip to main content
15,903,854 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralVectors Pin
glowskull0323-Apr-05 16:35
glowskull0323-Apr-05 16:35 
GeneralRe: Vectors Pin
Ravi Bhavnani23-Apr-05 16:52
professionalRavi Bhavnani23-Apr-05 16:52 
GeneralRe: Vectors Pin
glowskull0323-Apr-05 17:03
glowskull0323-Apr-05 17:03 
GeneralRe: Vectors Pin
Ravi Bhavnani23-Apr-05 18:17
professionalRavi Bhavnani23-Apr-05 18:17 
Questiondirectshow duplicate filter? Pin
Anonymous23-Apr-05 14:18
Anonymous23-Apr-05 14:18 
GeneralConsole Full Screen Pin
Aqeel A. Mirza23-Apr-05 12:44
sussAqeel A. Mirza23-Apr-05 12:44 
Generalmerging CTabCtrl and CComboBox Pin
nema3223-Apr-05 11:39
nema3223-Apr-05 11:39 
Generalhelp me please !!! Pin
need some help23-Apr-05 11:30
sussneed some help23-Apr-05 11:30 
hi...
i want som help in my project


Home Work: The Log Entry application
Due date 22/03/1426
Heba KURDI and Mona BENAISSA

As a member of a software development team, you have been delegated the task of implementing a C++ class that will be used to store a log entry.

A security guard may be required to keep a log of people entering and leaving a building, and note what their reasons for being in the building were. A log entry typically contains a sequence number to identify the entry, the name of the person making the entry, the date and time of the entry, and a short message that explains the purpose of the entry and other required details.

 The LogEntry class:
The class which you are required to implement stores the following information.

LogEntry Class
Field Data Type Description
LogEntryID Unsigned Integer A unique identification code associated with each log entry. It must be unique and in the range 1 to 9999. Also see NextAvailableLogID below. The default value is 0.
LastName 20 Characters The last name of the person submitting the log entry. The default value is a null string.
Initials 2 Characters The initials of the given names of the person submitting the log entry. The default value is a null string.
Date 10 Characters The date of the log entry stored in YYYY-MM-DD format. We will refer to this format as “Reverse Date FormT”. All stored dates must be after 2000-01-01, and no later than 9999-12-31. The default date is 2000-01-01.
Time 4 Characters The time of the log entry in HHMM 24 hour format, in increments of a minute. The times will range from 0000 to 2359. The default value is 0000.
LogMessage Up to 60 characters The message entered for this log entry. The message may contain up to 60 characters. The default value is a null string.
DateFormat A single character This data field is used to determine how the dates will be displayed in reports. It is set by the SetDateFormat method to ‘F’ if the date is to be displayed in forward format (i.e. DD-MM-YYYY), or ‘R’ if the date is to be displayed in reverse format (i.e. YYYY-MM-DD).

You are required to implement the following public member and friend functions for this LogEntry class. You may implement other private member functions if you wish.

 Default Constructor: A default Constructor to initialise all data to their default values.

 Overloaded Extraction Operator Function: An overloaded extraction operator function to enable a user to submit a log entry from the keyboard. This function should perform the following processes and validations.

 Prompt the user for a LastName and Initials and ensure that these are not null. The name can have no more than 20 characters and there can be a maximum of 2 characters in the initials.

 Prompt the user to enter the Date and the Time. The date and time must be validated. That is, 1 <= Day <= 31, 1 <= Month <= 12, and 2000 <= Year <= 9999. Do not worry about leap years, or months with less than 31 days, etc - just keep things simple. The date should be entered in DD-MM-YYYY format and stored in YYYY-MM-DD format.

For the time, 00 <= Hour <= 23, 00 <= Minute <= 59. Time is in a 24 hour format that goes up to 2359 and then wraps to 0000.

 Prompt the user for a valid LogMessage, which can have a maximum of 60 characters.

 If any invalid input is encountered, then a meaningful and informative error message must be displayed to the user and they should then be prompted to enter the data again, or your program should adjust the data to make it valid.

 Note that this extraction operator function should not set the LogEntryID field, as this will be done separately when the main program calls the SetLogEntryID member function. (See below).

You should note that the format of the date stored in the report is different from the format used to enter the date at the keyboard. Your function will need to manipulate the date from the entry format to that required for storage.

 DisplayReportHeading :
This function simply displays the report heading. That is, this function should display the following.

ID Date Time Init Surname Message
---- ---------- ---- ---- -------------------- ------------------------------

 SetLogEntryID :
This member function should simply set the LogEntryID for the current log entry to a value passed to the function. This function should be called by the main program. (See below).

 SetDateFormat:
This member function should simply set the DateFormat for the current log entry to a value passed to the function. The value passed to it must be either ‘F’ or ‘R’. The default value is ‘F’. This function should be called by main program. (See below).

 Overloaded Insertion Operator Function :
An overloaded insertion operator function to display the information in a log entry to the screen.

This function should output the details of the log entry onto a tabular report on the screen. An example of this output for 4 log entries is as follows. You should note that the format of the date displayed in the report may be different from the format used to store it in the log entry. Your function will need to manipulate the date from the stored format to that required for the report display.

You should also note that the message is wrapped if it is longer than 30 characters; and that the wrapping does not split up any words.

0001 01-01-2000 0100 ML Turnbull William Smith entered the
building to deliver flowers.

0002 01-01-2000 0134 ML Turnbull William Smith exited the
building.

0003 01-01-2000 0500 ML Turnbull Staff changeover, Turnbull
off, Schlotzer on.

0004 01-01-2000 0516 A Schlotzer Garbage truck collected
contents of 2 wheeley bins.

 Main Program :

The LogEntry class will be used in a test application program that you will write. The test application will allow the user to enter up to 20 log entries and be able to display a summary report of the log contents. A sample of the type of report your test program should produce is as follows.

ID Date Time Init Surname Message
---- ---------- ---- ---- -------------------- ------------------------------
0001 01-01-2000 0100 ML Turnbull William Smith entered the
building to deliver flowers.

0002 01-01-2000 0134 ML Turnbull William Smith exited the
building.

0003 01-01-2000 0500 ML Turnbull Staff changeover, Turnbull
off, Schlotzer on.

0004 01-01-2000 0516 A Schlotzer Garbage truck collected
contents of 2 wheeley bins.

Your main program should declare the following data fields.

Field Data Type Description
NextAvailableLogID Unsigned Integer Initially, this item should be set to 1, and then incremented by 1 each time a new log entry is recorded. This variable enables the LogEntryID to be automatically allocated by the system to the next available number by the SetLogEntryID member function.
NumberOfLogEntries Unsigned Integer Initially, this item should be set to 0, and then incremented by 1 after each customer's account is validated by the Overloaded Input member function.

Your main program should also demonstrate all of the functionality in the LogEntry class. For example, this main program should:

 Set the NextAvailableLogID to its initial value of 1.

 Invoke the Default Constructor member function by declaring an array of type LogEntry of size 20.

 Keep invoking the Overloaded Extraction member function for these log entries, until the user has recorded all 20 log entries or until the user does not want to record any more entries. During this phase, the program should :
 Call the SetLogEntryID member function to automatically set the LogEntryID for the current log entry.
 Increment the NextAvailableLogID. (See above).
 Increment the NumberOfLogEntries. (See above).

 Invoke the Display Report Headings member function.
 Call the SetDateFormat member function to set the DateFormat for displaying each log entry.
 Invoke the Overloaded Insertion member function for all log entries to display the details for each customer
GeneralRe: help me please !!! Pin
Ravi Bhavnani23-Apr-05 16:51
professionalRavi Bhavnani23-Apr-05 16:51 
GeneralRe: help me please !!! Pin
ThatsAlok24-Apr-05 18:29
ThatsAlok24-Apr-05 18:29 
GeneralCDatabase question Pin
Ivan Cachicatari23-Apr-05 9:36
Ivan Cachicatari23-Apr-05 9:36 
GeneralRe: CDatabase question Pin
22491723-Apr-05 10:01
22491723-Apr-05 10:01 
GeneralRe: CDatabase question Pin
Peter Ritchie24-Apr-05 8:07
Peter Ritchie24-Apr-05 8:07 
GeneralRe: CDatabase question Pin
Ivan Cachicatari8-May-05 4:57
Ivan Cachicatari8-May-05 4:57 
GeneralRe: CDatabase question Pin
Peter Ritchie8-May-05 6:33
Peter Ritchie8-May-05 6:33 
Generalfile find/copy Pin
maikol23-Apr-05 9:12
maikol23-Apr-05 9:12 
GeneralRe: file find/copy Pin
22491723-Apr-05 9:48
22491723-Apr-05 9:48 
GeneralRe: file find/copy Pin
maikol24-Apr-05 9:43
maikol24-Apr-05 9:43 
GeneralRe: file find/copy Pin
22491724-Apr-05 17:56
22491724-Apr-05 17:56 
Questionfireing OLE Control Events??? Pin
tobi7823-Apr-05 8:37
tobi7823-Apr-05 8:37 
Generalarray of structs read in from a file Pin
Truby4223-Apr-05 8:23
Truby4223-Apr-05 8:23 
GeneralRe: array of structs read in from a file Pin
Peter Ritchie23-Apr-05 8:29
Peter Ritchie23-Apr-05 8:29 
GeneralWinhttp from service not working Pin
gP_t_gr823-Apr-05 8:09
gP_t_gr823-Apr-05 8:09 
GeneralRe: Winhttp from service not working Pin
22491723-Apr-05 9:42
22491723-Apr-05 9:42 
GeneralRe: Winhttp from service not working Pin
gP_t_gr824-Apr-05 19:20
gP_t_gr824-Apr-05 19:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.