
Project one March 30, 2006
1
First Project
First Project –
–Julian Day
Julian Day
Number Calculation
Number Calculation
Larry Caretto
Computer Science 106
Computing in Engineering and
Science
March 30, 2006
2
Outline
• Outline first project
– Goals of project
– Connection with exercise seven
• Julian day number
– Definition
– Algorithm
• Code structure for first project
3
Project One Goals
• Design a program with several functions
• Look at communication among several
functions in a single program
• Write routine using mathematical
statements (and choice statements)
from pseudocode
• See that functions developed in a
general purpose manner for one code
can be reused in another code
4
What is a Julian Day Number?
• Continuous time used by astronomers
• Integer part is number of days
• Decimal part is fraction of a day starting
at noon: 6 pm is 0.25; midnight is 0.5
• Class start time,12:30 pm on Tuesday,
March 28, 2006 was Julian date number
2453823.02083333
– Fractional part is fractional part of a day
starting at noon (1/48 = 0.02083333…)
– What is JDN for start of today’s class?
2453825.02083333
5
Julian Day Number Cases
2454102.499998811:59:59.9 pm1-Jan-2007
2454102noon1-Jan-2007
2454101.50:00:00 am1-Jan-2007
2454101.256:00:00 pm31-Dec-2006
Julian NumberTimeCalendar Date
Your program must match these results!
• Run sample cases shown in assignment
6
Julian Day Number Algorithm
• Thirteen-step algorithm in exercise notes
– requires user input of integer year, month,
day, hour (0-23), minutes
• Use type double for seconds
– use integer operations on month, day, year
• To get fraction of day convert time to
common elapsed time (hours, minutes or
seconds) and divide by 24 h = 1440 min =
86,400 s
• Convert types to double before division!