Enum Weekday and WeekEnd

PHOTO EMBED

Sun Jun 09 2024 11:35:40 GMT+0000 (Coordinated Universal Time)

Saved by @meanaspotato #c

#include <stdio.h>

enum Day
{
    MONDAY,
    TUESDAY,
    WEDNESDAY,
    THURSDAY,
    FRIDAY,
    SATURDAY,
    SUNDAY
};

    
void print_day_category(enum Day day)
{
    if((day==MONDAY)||(day==TUESDAY)||(day==WEDNESDAY)||(day==THURSDAY)||(day==FRIDAY))
    {
        printf("Weekday\n");
    }
    else
    {
        printf("Weekend\n");
    }
}
void print_day_name(enum Day day)
{
    
    
        if(day==MONDAY)
        {
            printf("Monday");
            
        }
        if(day==TUESDAY)
        {
            printf("Tuesday");
           
        }
        if(day==WEDNESDAY)
        {
            printf("Wednesday");
           
        }
        if(day==THURSDAY)
        {
            printf("Thursday");
           
        }
        if(day==FRIDAY)
        {
            printf("Friday");
            
        }
        if(day==SATURDAY)
        {
            printf("Saturday");
            
        }
        if(day==SUNDAY)
        {
            printf("Sunday");
            
        }

}

int main(void)
{
    //keep this
	for (int i = 0; i < 70; i++)
	{
		print_day_name(i%7);
		printf(" is a ");
		print_day_category(i%7);
		printf("\n");
	}
	return 0;
}
content_copyCOPY

Monday is a Weekday Tuesday is a Weekday Wednesday is a Weekday Thursday is a Weekday Friday is a Weekday Saturday is a Weekend Sunday is a Weekend Objective Create a C program that uses an enumerated type to represent different days of the week. Implement functions that print the name of the day and whether it is a weekday or a weekend day. Day Table Enum Value Text Output MONDAY Monday TUESDAY Tuesday WEDNESDAY Wednesday THURSDAY Thursday FRIDAY Friday SATURDAY Saturday SUNDAY Sunday Program Components Enumerated Type: Declare an enumerated type named Day and populate it with the values: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY. Functions: print_day_category(enum Day day): This function takes an enumerated type as a parameter and prints out "Weekday" if the day is a weekday and "Weekend" if the day is a weekend. print_day_name(enum Day day): This function takes an enumerated type as a parameter and prints out the day as text, based on the table. Main Function: Implement a loop that iterates over each Day in the enumeration (70 iterations). Inside the loop, call print_day_name() with the current day. Print " is a ". Call print_day_category() with the current day. Print a newline after each iteration.