Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using C Part A Set up the following #defines o SECONDS IN A MINUTE MINUTES_IN_AN_HOUR Set up a macro called TRACE' that prints the current
Using C
Part A Set up the following #defines o SECONDS IN A MINUTE MINUTES_IN_AN_HOUR Set up a macro called TRACE' that prints the current line number using the global_LINE Create a function that takes number of hours, minutes, and seconds as integers, and returns the total number of seconds. Call your TRACE macro at the beginning of the function. o o The function signature should look like this: int numSeconds(int hours, int minutes, int seconds); The function should be defined after your main Part A o Create a time struct that contains the following attributes Hours Seconds Minutes o Write a function that calculates the difference between two time structures by calculating the total seconds each time structure represents by subtracting the total number of seconds. The function should return a new time structure that represents the elapsed time (in hours, minutes, and seconds) between the two times Where time1 represents 3:45:15 and time2 represents 9:44:03, the function should create and return a time structure that represents 5 hours 58 minutes, and 48 seconds All times are in military time o Do not use scanf for input. Just hardcode the following values for testing 1:30:45 and 16:30:45 00:01:01 and 23:59:59 12:00:00 and 12:00:00 Part B o Create another struct called DateTime that contains both the date and the time (using the time struct from part A). The struct must contain the following time struct enum type representing months (the enum should be defined outside of the struct) day year o Create structs with the following datetimes, and print them to the console January 19 1809 12:01 November 11 1922 6:00 January 6 2000 8:22 You must print these datetimes using the struct Part A Set up the following #defines o SECONDS IN A MINUTE MINUTES_IN_AN_HOUR Set up a macro called TRACE' that prints the current line number using the global_LINE Create a function that takes number of hours, minutes, and seconds as integers, and returns the total number of seconds. Call your TRACE macro at the beginning of the function. o o The function signature should look like this: int numSeconds(int hours, int minutes, int seconds); The function should be defined after your main Part A o Create a time struct that contains the following attributes Hours Seconds Minutes o Write a function that calculates the difference between two time structures by calculating the total seconds each time structure represents by subtracting the total number of seconds. The function should return a new time structure that represents the elapsed time (in hours, minutes, and seconds) between the two times Where time1 represents 3:45:15 and time2 represents 9:44:03, the function should create and return a time structure that represents 5 hours 58 minutes, and 48 seconds All times are in military time o Do not use scanf for input. Just hardcode the following values for testing 1:30:45 and 16:30:45 00:01:01 and 23:59:59 12:00:00 and 12:00:00 Part B o Create another struct called DateTime that contains both the date and the time (using the time struct from part A). The struct must contain the following time struct enum type representing months (the enum should be defined outside of the struct) day year o Create structs with the following datetimes, and print them to the console January 19 1809 12:01 November 11 1922 6:00 January 6 2000 8:22 You must print these datetimes using the structStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started