I\'m trying to Implement a Logger class and add a Logger object to this ATM Clas
ID: 3622631 • Letter: I
Question
I'm trying to Implement a Logger class and add a Logger object to this ATM Class using composition. I'm kind of stuck because I cannot seem to get anything working.
The log should be written to a text file on the hard drive and each entry should be appended to the file. Each Log entry should have a timestamp... The following classes should access the Logger: ATM, Withdrawal, Deposit, BalanceInquiry. Log all significant events such as Object creation & destruction, User Authentication failed/success, Execution of all ATM transaction types, etc...
Leave the user Authentication, I.E., the Account #'s and Pin $'s hard coded... A sample account:
Account #: 12345
Pin #: 54321
// What time is it?
// The Logger::Log() function will need this code
#include
#include
#include
#pragma warning( disable : 4996)
using namespace std;
void main(void)
{
// Test this first, then put it in Logger::Log()
char buf[30];
time_t rawtime;
time(&rawtime);
strcpy(buf, ctime(&rawtime));
buf[strlen(buf) - 1] = 0; // get rid of the LF
cout << buf;
}