#include <stdio.h>

#define SIZE 2 // Define Number of Employees "SIZE" to be 2

struct Employee
{
    int id;
    int age;
    double salary;
}; // Declare Struct Employee

/* main program */
int main(void)
{
    int i = 0;
    double tempsalary = 0.0;

    int option = 0;
    printf("---=== EMPLOYEE DATA ===---\n\n");

    struct Employee emp[SIZE] = { 0, 0, 0 };

    do
    {
        // Print the option list
        printf("1. Display Employee Information\n");
        printf("2. Add Employee\n");
        printf("0. Exit\n\n");
        printf("Please select from the above options: ");
        scanf("%d", &option); // Capture input to option variabl
        printf("\n");

        switch (option)
        {
            case 0: // Exit the program

                printf("Exiting Employee Data Program.\nGood Bye!!!");

                break;

            case 1:

                printf("EMP ID  EMP AGE EMP SALARY\n");
                printf("======  ======= ==========\n");
                for (int i = 0; i < SIZE; i++)
                {
                    printf("%6d%9d%11.2lf", emp[i].id, emp[i].age, emp[i].salary);
                    printf("\n");
                }

                break;

            case 2: // Adding Employee

                if (i > SIZE)
                {
                    printf("ERROR!!! Maximum Number of Employees Reached\n");
                }

                printf("Adding Employee\n");
                printf("===============\n");
                printf("Enter Employee ID: ");
                scanf("%d", &emp[i].id);
                printf("Enter Employee Age: ");
                scanf("%d", &emp[i].age);
                printf("Enter Employee Salary: ");
                scanf("%lf", &emp[i].salary);
                // printf("%.2lf",emp[i].salary);
                printf("\n");

                i++;

                break;

            default:
                printf("ERROR: Incorrect Option: Try Again\n\n");
        }

    } while (option != 0);

    return 0;
}