Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

Please answer this question with matlab Clock Function 2. (60 points) Write a program that asks the user to enter time of day. The program

Please answer this question with matlab image text in transcribed
Clock Function 2. (60 points) Write a program that asks the user to enter time of day. The program will convert from 12-hour format to the 24-hour format, or vice-versa. First write out your strategy as pseudocode in a.txt file. Include the inputs/outputs you expect each function to have. Here are the program specs: 1. Ask for an input of hour, minute, and seconds. a. Then ask the user if the time entered was in the 24-hour or 12-hour format. If the user responds with 12-hour, ask whether entered time was AM or PM. Otherwise, ask no more questions. Check each of the user entries to ensure they are in the appropriate range. For example, none of the values should be negative, minutes should be in the range of 0 to 60, if user indicated 12-hour clock then value should be b/w 1 and 12, etc. If any entry is incorrect, use the error0 function to display a unique and meaningful message for each error situation. b. c. Convert the time to the other time format (If user entered in 12-hr format, convert to 24-hr format. If user entered in 24-hr format, convert to 12-hr format.) Display the converted time stating clearly the new format. Modularize your code. Remember that in MATLAB you can have functions with multiple inputs and/or outputs. (Sections 6.1 and 6.2 in the text.) 2. 3. 4. Have a function that takes in all the user inputs for part 1. This function should have no input arguments and 5 output arguments (hour, minute, second, format, am/pm). Your error checking should be implemented within this function. (getlnputs) Have a conversion function for part 2. (convertTime) Have a display function for part 3. (displayTime) a. b. c. Sample inputs and outputs Enter Hour: 10 Enter Minutes: 10 Enter Seconds: 10

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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