Problem Statement Write a program to display the current date and time in the following format: Today is Wednesday, March 18, 2020 The current time is 2:07 p.m. In addition to the main module, your...

I have a homework assignment for c++ and I need help with it. I have attached details of the assignment in a pdf file. I need to produce code and flow charts for it. It's basic 301 programming class so it cannot go out of the scope of the class. I've attach the starter file for the assignment as well. I'll just be working on the output modules, will not be building the program from scratch. Thank you


Problem Statement Write a program to display the current date and time in the following format: Today is Wednesday, March 18, 2020 The current time is 2:07 p.m. In addition to the main module, your program must include the following modules (you cannot change the specified name or parameter list — the number of parameters, the type of each parameter, or their order — for any of these modules): get_datetime( out year As Integer, out month As Integer, out day As Integer, out hour As Integer, out minute As Integer ) An input module that obtains the current date and time components from the system clock. The year is a four-digit integer accurate for years since 1900, the month an integer from 1 and 12, the day an integer from 1 to 31, the hour an integer from 0 to 23, and the minute an integer from 0 to 59. 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, as in Lab #3. compute_dow( in year As Integer, in month As Integer, in day As Integer, out dow As Integer ) A processing module that computes the weekday number for the given date, as in Lab #4. get_month_name( in month As Integer, out month_name As String ) A processing module that determines the month name corresponding to the given month number. get_weekday_name( in dow As Integer, out weekday_name As String ) A processing module that determines the weekday name corresponding to the given weekday number (where zero is "Sunday", 1 is "Monday", etc.). display_date( in year As Integer, in month As Integer, in day As Integer ) An output module that displays a date on the screen given the component year, month, and day numbers — e.g., Wednesday, March 18, 2020 . (Note: Due to the logic involved, this module would normally be implemented as a processing module that produces a string. Concatenation of strings and numbers in C++ requires knowledge of “string streams”, which are out of scope for CISP 301. Sending the result to the screen is a reasonable compromise, as the code could then easily be transformed into a processing module that uses a string stream instead of the std::cout stream.) display_time( in hour As Integer, in minute As Integer ) An output/controller module that displays a time on the screen in 12-hour format given the component hour and minute numbers in 24-hour format. This is accomplised by calling upon the services of the display_hour , display_minute and display_ampm modules described below. Five minutes after midnight (hour=0, minute=5) shows 12:05 a.m. Two-thirty in the afternoon (hour=14, minute=30) shows 2:30 p.m. (As with the previous module, this module and those it calls would be better implemented as processing modules that produce strings.) display_hour( in hour As Integer ) An output module that displays the hour on the screen in 12-hour format given an hour in 24-hour format. display_minute( in minute As Integer ) An output module that displays the given minute on the screen. Minutes are displayed with a leading zero when less than ten. display_ampm( in hour As Integer ) An output module that displays “a.m.” or “p.m.” on the screen given an hour in 24-hour format. Each of these modules may only be called once in your program. The datetime.cpp starter file (Links to an external site.) contains declaration prototypes for these modules, along with http://cis.scc.losrios.edu/~krofb/cisp301/labs/lab06.html http://cis.scc.losrios.edu/~krofb/cisp301/labs/lab06.html finished implementations of the main and get_datetime modules (do not change the implementation of either module). Submission Guidelines You must create a Design and Testing document that includes a structure chart for your program, test plan, and flowcharts for the display_time, display_hour , display_minute and display_ampm modules. Submit a test plan with at least four different test cases that attempt to uncover potential problems in the display_time module (e.g., times in the morning and afternoon). Use the sample test plan format that follows as a guide. Submit your Analysis and Design document as a PDF file, along with a copy of your program source code file, using the “Submit Assignment” button in Canvas by 11:59pm on the due date. Remember to submit both files at the same time. (If you make a mistake, or realize later that you need to post a correction, be sure to resubmit both files at the same time.) Sample Test Plan Format Inputs (24-hour clock) Outputs (12-hour clock) hour minute hour minute am/pm Scoring Guide Here's what your instructor will be looking for when grading your assignment: 1. Structure chart is complete and accurate, making use of modules as specified in the assignment. 2. Flowcharts for the display_time and display_hour modules are complete and accurate. 3. Flowcharts for the display_minute and display_ampm modules are complete and accurate. 4. Test plan has at least four different cases, including a diversity of times designed to uncover potential issues with the program. 5. Source code includes complete header comments; modules are documented per class style. 6. Source code includes main and get_datetime modules unchanged from given starter file. 7. Source code successfully implements and uses the modules described in the assignment. 8. Program displays dates (dow, month, day, and year) in a manner that closely matches the sample given in the assignment. 9. Program displays times (hour, minute, am/pm) in a manner that closely matches the sample given in the assignment. 10. Source code presented neatly, with appropriate indenting and white space. Starter file for the program Can’t change the main module or get_datetime module void get_datetime(int& year, int& month, int& day, int& hour, int& minute); void compute_jdn(int year, int month, int day, int& jdn); void compute_dow(int year, int month, int day, int& dow); void get_month_name(int month, std::string& month_name); void get_weekday_name(int dow, std::string& weekday_name); void display_date(int year, int month, int day); void display_time(int hour, int minute); void display_hour(int hour); void display_minute(int minute); void display_ampm(int& hour); int main() { int year, // current year month, // current month number (1..12) day, // current day (1..31) hour, // current hour (0..23) minute; // current minute (0..59) get_datetime(year, month, day, hour, minute); // Display current date std::cout < "today="" is="" ";="" display_date(year,="" month,="" day);="" std::cout="">< std::endl;="" display="" current="" time="" std::cout="">< "the="" current="" time="" is="" ";="" display_time(hour,="" minute);="" std::cout="">< std::endl;="" }="" an="" input="" module="" that="" obtains="" the="" current="" date="" and="" time="" components="" from="" the="" system="" clock.="" the="" year="" is="" a="" four-digit="" integer="" accurate="" for="" years="" since="" 1900,="" the="" month="" an="" integer="" from="" 1="" to="" 12,="" the="" day="" an="" integer="" from="" 1="" to="" 31,="" the="" hour="" an="" integer="" from="" 0="" to="" 23,="" and="" the="" minute="" an="" integer="" from="" 0="" to="" 59.="" void="" get_datetime(int&="" year,="" int&="" month,="" int&="" day,="" int&="" hour,="" int&="" minute)="" {="" time_t="" timer;="" struct="" tm*="" now;="" time(&timer);="" now="localtime(&timer);" year="1900" +="" now-="">tm_year; month = now->tm_mon + 1; day = now->tm_mday; hour = now->tm_hour; minute = now->tm_min; } void compute_jdn(int year, int month, 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 compute_dow(int year, int month, int day, int& dow) { int jdn; compute_jdn(month, day, year, jdn); dow = (jdn + 1) % 7; }
Mar 31, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here