Git Product home page Git Product logo

#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; }

EMBY's Projects

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.