#include #include #include
#define BOLD "\033[1m" //BOLD TEXT #define RED "\033[31m" //RED #define GREEN "\033[32m" //GREEN #define RESET "\033[0m" //RESET COLOR
using namespace std;
const int daysInWeek = 6; // Number of days in a week const int hoursInDay = 24; // Hours in a day
void inputCredentials(string& name, string& course); // Function to input COQC credentials void inputTimeInOut(int timeIn[], int timeOut[]); // Function to input time in and time out int calculateTotalHours(int timeIn[], int timeOut[]); // Function to calculate total duty hours void design(); // Function to display design elements void header(); // Function to display header information
int main() { string name, course; int timeIn[daysInWeek], timeOut[daysInWeek];
header();
int ans = 1;
while (ans == 1) {
inputCredentials(name, course);
inputTimeInOut(timeIn, timeOut);
int totalHours = calculateTotalHours(timeIn, timeOut);
design();
cout << BOLD << " WEEKLY DUTY REPORT: " << name << " (" << course << ")" << endl;
cout << endl;
cout << " TOTAL DUTY HOURS: " << totalHours << " hrs" << RESET << endl;
if (totalHours >= daysInWeek * hoursInDay) {
cout << GREEN << "* You have met the minimum weekly duty hour requirement.\n" << RESET;
} else {
cout << RED << "* You have not met the minimum weekly duty hour requirement.\n";
cout << "* See you on training day. (:\n" << RESET;
}
design();
cout << "Do you want to input duty hours again? (Press 1 for YES, 0 for NO): ";
cin >> ans;
system("cls");
}
return 0;
}
void inputCredentials(string name, string course) { cout << "\n"; cout << "* LOGIN SYSTEM *\n"; cout << "\n"; cout << " Enter Full Name: "; cin.ignore(); getline(cin, name); cout << " Enter School ID: "; cin >> id; cout << " Enter Course : "; cin >> course; cout << "*****************************************************************\n";
system("pause");
system("cls");
cout << BOLD;
cout << "***********************************************\n";
cout << "* COQC CREDENTIALS *" << endl;
cout << "***********************************************" << endl;
cout << " COQC NAME : " << name << endl;
cout << " STUDENT NO: " << id << endl;
cout << " COURSE : " << course << endl;
cout << "***********************************************" << endl;
cout << "* REMINDER: IF YOU DID NOT WORK ON THAT DAY, ENTER 0 AS TIME IN AND TIME OUT. *\n";
cout << "***********************************************\n" << endl;
cout << RESET << endl;
}
void inputTimeInOut(int timeIn[], int timeOut[]) { for (int d = 0; d < daysInWeek; ++d) { cout << "Enter Time In (in military format) for Day " << d + 1 << " (e.g., 800 for 8:00 AM): "; cin >> timeIn[d]; cout << "Enter Time Out (in military format) for Day " << d + 1 << ": "; cin >> timeOut[d]; } }
int calculateTotalHours(int timeIn[], int timeOut[]) { int totalHours = 0; for (int i = 0; i < daysInWeek; ++i) { if (timeIn[i] != 0 && timeOut[i] != 0) { int hours = (timeOut[i] - timeIn[i]) / 100; totalHours += hours; } } return totalHours; }
void design() { cout << "*********************************************************************" << endl; }
void header() { cout << BOLD; cout << "\n"; cout << "* COQC DUTY SYSTEM *\n"; cout << "\n"; cout << "* Description: The COQC Duty System is designed for the scheduling\n"; cout << "* and management of weekly duties for COQC. Users \n"; cout << " input their time in and time out for each day, and*\n"; cout << "* the system calculates the total duty hours. \n"; cout << " \n"; cout << " Creator: EDWOOD MENDOZA \n"; cout << " Course : DIT-1 \n"; cout << " \n"; cout << " Publish date: February 10, 2024 \n"; cout << " *\n"; cout << "*****************************************************************" << RESET << endl; }