Question: Computer users and applications need the time and date for various reasons. This can be achieved by keeping track of the number of seconds that
Computer users and applications need the time and date for various reasons. This can be achieved by keeping track of the number of seconds that have elapsed since some reference date and time. The number of seconds elapsed can then be converted to determine the current date and time. (The built-in matlab functions that do something like this include date and clock.) For this assignment, your will write a program to determine the time and date corresponding to a elapsed number of seconds since 00: 00: 00 on 1 January 2016. Have the user input the value of elapsed seconds. The output (to the screen) should be the corresponding hour (in military time), minute, second, day of the month, month name, year, and day of the week name (Sunday Saturday). Your output should look like the following: 23:59:32 2 January 2018 Tuesday Dont forget that a leap year has 366 days with 29 days in February. Leap years are years that are evenly divisible by 4, with the exception of those evenly divisible by 100 but not 400. Your program should be accomplished using the assignment operator (=), mathematical operators ( +, -, /, *, ^), logical operators ( &, |, ~), relational operators ( ==, <, <=, etc.), decision making and repetition constructs (if-elseif-else, switch-case-otherwise, for, while), and input/output functions we've learned (input, display, sprintf, fprintf). To determine whether a number is evenly divisible, you are also allowed to use the built-in matlab rem or mod functions. No other built-in matlab functions are allowed. You should use modular programming to solve this problem. Your main script should contain only a handful of commands, each of which should be a call to a function you have written. It is a very good idea to code this in stages. First calculate the year, output the result, and make sure it works. Then move to the month and make sure that works, then the numerical date, then the hour, etc. Work on the day of the week name only after all the previous parts of the program work. Go through the program design steps discussed in class. Also be sure to document your code well and use good programming practices. For full credit, provide several appropriate test cases of different types. When your program executes correctly and cleanly and has been verified with appropriate testing, you are ready to submit your assignment for grading.
What to turn in: Submit your working *.m files and a single PDF document that contains your solution report containing all the required components (specified in previous assignments, e.g. HW 7). All required files for this assignment should be submitted together as one electronic file archive. Files should be neatly organized, rationally named, and placed in a folder named HW<#>Group (e.g. HW5Group2). Use a *.zip or *.rar format for submittal. Grading will be based on the following:
70% Correctness (Do the flowchart and program solve the problem correctly under robust conditions. Has the program been verified with appropriate testing? Does the solution meet all the detailed requirements?)
20% Presentation (Are good practices used? Is the work easy to read and follow?) 10% Elegance (How simple and efficient is the algorithm? Could the same result be achieved through a more direct procedure with fewer computations?)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
