Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

. (a) Write a MatLab program that uses Matlab's switch construction to convert a date entered lw i he user in the fonn nun dd/yyyy

image text in transcribed

. (a) Write a MatLab program that uses Matlab's switch construction to convert a date entered lw i he user in the fonn nun dd/yyyy ini its iest form Le , Month day, year). For example, if 02/17/2019 is entered, the program should print out " February 17, 2019". To read in a text string entered by the user, use the following form of the input statement Date-input('Entor date as mm/dd/yyyy: ,, ,s') The string variable Date will then be a 10-clement vector, whose clements are the individual characters in the string. You can extract a piece of the string and convert it to a numeric variable using the colon operator to specify a range of elements as a vector index and the MatLab function str2numO. For example, to extract the number for the month from Date, isc MonthNumber str2num (Date (1:2)) To save typing, your program only nceds to consider dates that are in the first half of the year January through June. You sh- -n . (b) Add code to your program that prints out the number of the day in the year corresponding to the date the the user has entered. For example, if the user enters 03/12/2019, the program should print out "This is day number 71 of 2019" The mumher of days n of tia monhs are Jan-31, Feb-28, Mar-31, Apr-30, May-31, Jun-30

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_2

Step: 3

blur-text-image_3

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 Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

List behaviors to improve effective leadership in meetings

Answered: 1 week ago