To convert a time in local minutes to local time you can use the follo (the sunset equations look the same). sunrise sunrise_hour %3D 60

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Please use python code...not c++

sunrise = 720 + 4(longitude – ha) – eqtime – 60 · timezone
sunset is the time in UTC minutes of sunset.
sunset = 720 + 4(longitude + ha) – eqtime – 60 · timezone
To convert a time in local minutes to local time you can use the following equations
(the sunset equations look the same).
sunrise
sunrise hour
60
sunrise_minute
sunrise – (sunrise_hour · 60)
Note: The strange brackets around sunrise_hour are the floor function, which rounds
the expression inside them down. You can easily achieve this in python by simply
assigning the value to an integer variable, or you can use the floor function defined in
math module.
(Case Study Credit/Source: Machine Projects Series, Dr. Don Roberts, Evansville
University, USA)
Write a single function to implement the algorithm in the case study above. Give the
following properties to your function.
i.
ii.
а.
Use parameters
Call the function using arguments supplied by the user "
Sample Runs (to see if your code is working correctly)
Daylight-Sensitive Zombie Protection System
This program will calculate sunrise and sunset time for any date and location
Enter latitude, longitude:40.75 -74 Enter Timezone:-5
Enter day of year:180 Sunrise: 4:34
Sunset: 19:39
Daylight-Sensitive Zombie Protection System
This program will calculate sunrise and sunset time for any date and location
Enter latitude, longitude:37.5 -88.0 Enter Timezone:-6
Enter day of the year:11 Sunrise: 7:22
Sunset: 17:07
Transcribed Image Text:sunrise = 720 + 4(longitude – ha) – eqtime – 60 · timezone sunset is the time in UTC minutes of sunset. sunset = 720 + 4(longitude + ha) – eqtime – 60 · timezone To convert a time in local minutes to local time you can use the following equations (the sunset equations look the same). sunrise sunrise hour 60 sunrise_minute sunrise – (sunrise_hour · 60) Note: The strange brackets around sunrise_hour are the floor function, which rounds the expression inside them down. You can easily achieve this in python by simply assigning the value to an integer variable, or you can use the floor function defined in math module. (Case Study Credit/Source: Machine Projects Series, Dr. Don Roberts, Evansville University, USA) Write a single function to implement the algorithm in the case study above. Give the following properties to your function. i. ii. а. Use parameters Call the function using arguments supplied by the user " Sample Runs (to see if your code is working correctly) Daylight-Sensitive Zombie Protection System This program will calculate sunrise and sunset time for any date and location Enter latitude, longitude:40.75 -74 Enter Timezone:-5 Enter day of year:180 Sunrise: 4:34 Sunset: 19:39 Daylight-Sensitive Zombie Protection System This program will calculate sunrise and sunset time for any date and location Enter latitude, longitude:37.5 -88.0 Enter Timezone:-6 Enter day of the year:11 Sunrise: 7:22 Sunset: 17:07
MACHINE PROJECT 1
As the documentary, "I Am Legend," reveals, there is a particular subspecies of
zombies that will only come out at night. (there is a debate as to whether that
particular species of undead are zombies or vampires, but at this critical point in
history, such debate is pedantic and counterproductive). Therefore, it is of the utmost
importance that we be able to calculate the time of the local sunrise and sunset.
Fortunately, astronomers have left us the equations that allow us to calculate this.
Unfortunately, these astronomers were eaten by zombies before they could turn the
math into a useful program. The following is the algorithm that is their legacy.
To calculate the local time of sunrise and sunset, we need the following input data:
Latitude: Latitude of the current location in degrees (+ = North, - = South)
Longitude: Longitude of the current location in degrees (+ = East, - = West)
Time zone: The local timezone as offset from UTC (e.g. CST=-6)
day of year: The numerical day of the year for which we are performing the
calculation
%3D
%3D
%3D
The following are the equations required to calculate sunrise and sunset times.
is the day of the year converted into an angle in radians.
(day.of_year – 1)
365
eqtime is the equation of time in minutes (the number of minutes that the position of
the sun differs from the actual time).
eqtime = 229.18(0.000075 + 0.001868cos(y) – 0.032077sin(y) – 0.014615cos(2y)
0.040849sin(2y))
%3D
decl is the declination of the sun in radians.
decl = 0.006918 – 0.399912cos(v) + 0.070257sin(y)
0.006758cos(2) + 0.000907sin(2y) – 0.002697cos(3y) + 0.00148sin(3y)
-
ha is the hour angle of the sun in degrees.
cos(1.5853)
cos(latitude · 50) cos(decl)
180
- tan(latitude ·
) tan(decl)
180
ha = arccOS
sunrise is the time in local minutes of sunrise.
Transcribed Image Text:MACHINE PROJECT 1 As the documentary, "I Am Legend," reveals, there is a particular subspecies of zombies that will only come out at night. (there is a debate as to whether that particular species of undead are zombies or vampires, but at this critical point in history, such debate is pedantic and counterproductive). Therefore, it is of the utmost importance that we be able to calculate the time of the local sunrise and sunset. Fortunately, astronomers have left us the equations that allow us to calculate this. Unfortunately, these astronomers were eaten by zombies before they could turn the math into a useful program. The following is the algorithm that is their legacy. To calculate the local time of sunrise and sunset, we need the following input data: Latitude: Latitude of the current location in degrees (+ = North, - = South) Longitude: Longitude of the current location in degrees (+ = East, - = West) Time zone: The local timezone as offset from UTC (e.g. CST=-6) day of year: The numerical day of the year for which we are performing the calculation %3D %3D %3D The following are the equations required to calculate sunrise and sunset times. is the day of the year converted into an angle in radians. (day.of_year – 1) 365 eqtime is the equation of time in minutes (the number of minutes that the position of the sun differs from the actual time). eqtime = 229.18(0.000075 + 0.001868cos(y) – 0.032077sin(y) – 0.014615cos(2y) 0.040849sin(2y)) %3D decl is the declination of the sun in radians. decl = 0.006918 – 0.399912cos(v) + 0.070257sin(y) 0.006758cos(2) + 0.000907sin(2y) – 0.002697cos(3y) + 0.00148sin(3y) - ha is the hour angle of the sun in degrees. cos(1.5853) cos(latitude · 50) cos(decl) 180 - tan(latitude · ) tan(decl) 180 ha = arccOS sunrise is the time in local minutes of sunrise.
Expert Solution
steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Fundamentals of Boolean Algebra and Digital Logics
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education