Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use Matlab to solve this equation. If you can please solve it in less than 10 lines. Problem 5 One of the most frustrating aspects
Use Matlab to solve this equation.
Problem 5 One of the most frustrating aspects of using the Gregorian calendar is that it is difficult to communicate/compute elapsed time. For example, if I tell you that something is experienc- ing its 2-month anniversary, you don't know the exact number of days that have elapsed unless I tell you which 2 months - February 3rd to April 3rd is 59 days (in a non-leap year), while April 3rd to June 3rd is 61 days. For this problem, you need to write a program that Problem 5 continued on next page... Page 2 of 3 will accept two days of the same year (in month-day form) and output the elapsed time between the two days (not including the last day!). To keep it simple, the program should first ask the user for the month of the first day, then the date of the first day, then the month of the second day, and lastly the date of the second day (so four total prompts). For example, if you wanted to know the elapsed number of days between September 4th and November 18th, you would enter 9 into the first prompt, 4 into the second prompt, 11 into the third prompt, and 18 into the fourth prompt. Assume that it is not a leap year! Hint: You can find the elapsed time between two days by taking the difference between the numbers of their cumulative day. For example, January 4th is the 4th day of the year, and February 6th is the 37th day of the year. If I subtract 4 from 37, I find that 33 days elapse between those two dates. This problem has 10 points. Note: For this problem, any correct solution with less than 10 lines of code will receive 5 bonus points If you can please solve it in less than 10 lines.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started