Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, can someone take a look at this assignment? Modify the program you created in the previous lab assignment so that it prompts the user

Hi, can someone take a look at this assignment?

Modify the program you created in the previous lab assignment so that it prompts the user to enter todays date and their birthday. Compute the JDN for both dates, the number of days between them, and the day of the week number for the users birthday. The program should match the following sample as closely as possible (the underlined numbers in bold are examples of inputs made by the user your program will not underline the users inputs or show them in bold): The JDN for 2/19/2019 is 2458534 The JDN for your birthday on 6/1/1972 was 2441470 The DOW on your birthday was 4 (0=Sun, 1=Mon, etc.) It has been 17064 days since you were born Design Requirements Your program must include at least the following modules (when specied, you may not change the name or parameter list the number of parameters, the type of each parameter, or their order for any of these modules): get_date(__________, __________, __________) An input module that retrieves the components of a date (month, day, year) from the user. The month is expected to be an integer from 1 to 12, the day an integer from 1 to 31, and the year a four-digit integer. As in v.2 of the The Cricket as a Thermometer handout, you may assume the user has been provided with information on the screen indicating what date should be entered (e.g., todays date or their birthday). You may also assume that the user enters valid numbers for dates since 15 October 1582. compute_jdn(in year As Integer, in month As Integer, in day As Integer, out jdn As Integer) A processing module that computes the JDN for the given date. compute_dow(in year As Integer, in month As Integer, in day As Integer, out dow As Integer) A processing module that computes the day of the week (DOW) number an integer where 0 = Sunday, 1 = Monday, etc. for the given date. The DOW is the remainder when ( JDN + 1 ) is divided by 7. compute_days(__________, __________, __________) A processing module that computes the number of days between two given JDNs. You may assume the JDN provided in the rst parameter is less than or equal to the JDN provided in the second parameter. display_date(in year As Integer, in month As Integer, in day As Integer) An output module that displays the given date in the form m/d/yyyy. of 1 2 display_results(__________, __________, __________, in today_jdn As Integer, __________, __________, __________, in birthday_jdn As Integer, in birthday_dow As Integer, in days_between As Integer) An output module that displays todays date (as input by the user) and corresponding JDN, the users birthday and corresponding JDN, the weekday number of the users birthday, and number of days since the user was born. You are welcome to add additional modules, but they may not closely duplicate the functionality of any module listed above.

/////////////////////////////////////////////

//////////////////////////////////////////////

This is my codes from previous (visual studios C++)

#include #include

void input_data(int &month, int &year, int &day); void calculations(int month, int year, int day, int &jdn); void output_results(int &month, int &year, int &day, int &jdn);

void pause();

int main() { int day; int month; int year; int jdn; input_data(month, year, day); calculations(month, year, day, jdn); output_results(month, year, day, jdn); pause(); }

void pause();

void input_data (int &month, int &year, int &day) { std::cout << "enter a month(jan = 1, feb = 2, etc.) : "; std::cin >> month; std::cout << "enter a day number(1..31) : "; std::cin >> day; std::cout << "enter a year using four digits : "; std::cin >> year; } void calculations(int month, int year, int day, int &jdn) { int a, m, y, leap_days; a = (14 - month) / 12; m = (month - 3) + (12 * a); y = year + 4800 - a; leap_days = (y / 4) - (y / 100) + (y / 400); jdn = day + (((153 * m) + 2) / 5) + (365 * y) + leap_days - 32045; }

void output_results(int &month, int &year, int &day, int &jdn) { std::cout << " The JDN for " << month << "/" << day << "/" << year << " is " << jdn << std::endl;

}

void pause()

{ std::cin.clear(); std::cin.ignore(std::numeric_limits::max(), ' '); std::cout << std::endl; std::cout << "Press the enter key to continue . . ."; std::cin.get(); }

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

Students also viewed these Databases questions

Question

6. Explain the strengths of a dialectical approach.

Answered: 1 week ago

Question

2. Discuss the types of messages that are communicated nonverbally.

Answered: 1 week ago