Question: Date Lab: help with c programming, below is the instructions. This assignment will focus on the use of functions and the passing of parameters. You
Date Lab: help with c programming, below is the instructions. This assignment will focus on the use of functions and the passing of parameters. You are to construct a C program, date.c, which performs each of the following operations. Converts a calender date into a Julian date. Converts a Julian date into a calender date. Computes the number of days between and two calender dates. A calender date is simply a date that contains a year, month, and day and a Julian date is an integer between 1 and 366, inclusive, which tells how many days habe elapsed since the first of January in the current year (including the day for which the date is calculated). For example, calender date 4/12/2008 is equivalent to Julian date 103, 2008. Your program should contain a selection menu (hint: think do-while loop) that allows the user to choose one of the options. An illustration is given below: DATE SELECTION MENU 1) Convert calender date into Julian date 2) Convert Julian date into calender date 3) Compute days between two calender dates 4) Exit program ENTER SELECTION (1-4): Be sure your program contains separate functions for each of the required operations, passing parameters as necessary. Remember that no global variables are allowed in your program except for the file pointer. You should create at least the following functions for your program: displayMenu displays selection menu and promps user for selection getCalenderDate prompts and gets calender date from user getJulianDate prompts and gets Julian date from user toCalender converts Julian date into calender date toJulian converts calender date into Julian date daysBetweenDates calculates the number of days between two calender dates Hint to compute the number of days between two calender dates: For each date, figure out the number of days since January 1, 1900 and then subtract. For this assignment we will define a leap year as any year that is evenly divisble by 4 but not 100, except that years divisble by 400 are leap years. Here's a function you can use to calculate leap years. Try and work through its details int isLeapYear(int year) { return ((!(year %4) && (year % 100) || !(year % 400)); } Test data for the lab is given below. Be sure to turn in output for each of the test data provided below. The information appearing in the parentheses after each piece of the test data are the correct (hopefully) solutions. You may use these solutions to test your program on the supplied test data. Ultimately, however, your program should be able to run on any valid data. Convert Calender Date Into Julian Date 11 15 1922 (319, 1922) 2 29 1984 (60, 1984) 7 7 2000 (189, 2000) Convert Julian Date Into Calender Date 53 1947 ( 2/22/1947) 211 1995 ( 7/30/1995) 360 2006 (12/26/2006) Compute Number of Days Between Two Calender Dates 5 12 1949 16 1900 (17801) 12 15 1985 1 1986 76) 1 1 1900 7 1993 (34155)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
