Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include using namespace std; // complete the JulianDate class // write your code in the JulianDae class // complete the code in main class

#include #include

using namespace std;

// complete the JulianDate class // write your code in the JulianDae class // complete the code in main class JulianDate { // Make all your class access is public

// first define your variable type and variable (year, month, day, hour, mins, sec)

// write your default constructor that set variables today's date // write your code here // Name it JulianDate

// Write your nod-default constructor that set variables // write your code here // the Name should be the same as default constructor

// write function that calculate julian number from given date // your function should return the value // use calc_juliandate as the function name // write your code here

// write function that calculate difference between two Julian date // use diff_calc_juliandate as the function name // write your code here

};

/* how many days in a year? 365 leap year: if year MOD 4 == 0 LEAP EXCEPT if year MOD 100 == 0 NOT LEAP YEAR Except if year MOD 400 == 0 LEAP

Leap years: NO 1900 YES 1904 YES 1908 YES 2000 NO 2100 YES 2400

days since EPOCH = 365 * (year - 2000) + years/4 - ....

2018 - 2000 = 18

seconds in a day = 24*60*60 = 86400

hh:mm:ss

00:00:00 0.0 12:00:00 0.5

18*365+18/4 - 18/100 + 18/400 18*364+4 = 6574

6574.041666666 --> Jan 1, 2018, 01:00:00 */ //int JulianDate::EPOCH = 2000; // Jan.1 2000, 00:00:00 = 0

int main() {

cout << "########" << endl; cout << "Main Problem" << endl; cout << "########" << endl;

// Run your class on this code and calculate the difference of Julian number below

cout.precision(20); JulianDate x(2007, 2, 8, 0, 0, 0); // how many days since day 0? dy = (2018 - 2000) * 365 double x1 = x.calc_juliandate(); cout << x1 << endl;

JulianDate y(2000, 12, 31, 0, 0, 1); double y1 = y.calc_juliandate(); cout << y1 << endl;

//manual calculation of the difference between two dates, e.g., x1 - y1 = results //print out the result // write your code here

// Now use your class function to find the difference between two dates // print out the result // write your code here

//example of date to Julian date format without hour/min/sec //7/4/1776 2369916 //12/31/2000 2451910 //2/8/2007 2454140 //2/9/2007 2454141

cout << "====[ end ]====" << endl;

return 0; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Reliability Engineering Designing And Operating Resilient Database Systems

Authors: Laine Campbell, Charity Majors

1st Edition

978-1491925942

More Books

Students also viewed these Databases questions