2.) Create a MATLAB program (using if-elseif-else) that will input time based on a 12-hour dlock and output its corresponding value based on a 24-hour clock. Display an error message if the time entered is invalid. Time based on a 12-hour clock Time based on a 24-hour clock 1:00 – 11:59 AM 1:00 -11:59 12:00 – 12:59 AM 0:00 – 0:59 12:00 – 12:59 PM 12:00 – 12:59 1:00 – 11:59 PM 13:00 – 23:59 Sample Output: 1.) Input time based on a 12-hour clock: 658 Input A or a for [AM] and P or p for [PM]: A You entered 6:58 AM The equivalent time based on a 24-hour clock is 6:58 2.) Input time based on a 12-hour clock: 1201 Input A or a for [AM] and P or p for [PM]: A You entered 12:01 AM The equivalent time based on a 24-hour clock is 0:01 3.) Input time based on a 12-hour clock: 1251 Input A or a for [AM] and P or p for [PM]: p You entered 12:51 PM The equivalent time based on a 24-hour clock is 12:51 4.) Input time based on a 12-hour clock: 809 Input A or a for [AM] and Por p for [PM]: P You entered 8:09 PM The equivalent time based on a 24-hour clock is 20:09 5.) Input time based on a 12-hour clock: 1601. Input A or a for [AM] and Por p for [PM]: A You entered an INVALID time! 6.) Input time based on a 12-hour clock: 1089 Input A or a for [AM] and P or p for [PM]: p You entered an INVALID time! 7.) Input time based on a 12-hour clock: 1145 Input A or a for [AM] and P or p for [PM]: S You entered an INVALID time!

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
2.) Create a MATLAB program (using if-elseif-else) that will input time based on a 12-hour clock
and output its corresponding value based on a 24-hour dlock. Display an error message if
the time entered is invalid.
Time based on a 12-hour clock
Time based on a 24-hour clock
1:00 – 11:59 AM
1:00 -11:59
12:00
12:59 AM
0:00 – 0:59
12:00 – 12:59 PM
12:00 – 12:59
1:00 – 11:59 PM
13:00 – 23:59
Sample Output:
1.) Input time based on a 12-hour clock: 658
Input A or a for [AM] and P or p for [PM]: A
You entered 6:58 AM
The equivalent time based on a 24-hour clock is 6:58
2.) Input time based on a 12-hour clock: 1201
Input A or a for [AM] and P or p for [PM]: A
You entered 12:01 AM
The equivalent time based on a 24-hour clock is 0:01
3.) Input time based on a 12-hour clock: 1251
Input A or a for [AM] and P or p for [PM]: p
You entered 12:51 PM
The equivalent time based on a 24-hour clock is 12:51
4.) Input time based on a 12-hour clock: 809
Input A or a for [AM] and Por p for [PM]: P
You entered 8:09 PM
The equivalent time based on a 24-hour clock is 20:09
5.) Input time based on a 12-hour clock: 1601
Input A or a for [AM] and P or p for [PM]: A
You entered an INVALID time!
6.) Input time based on a 12-hour clock: 1089
Input A or a for [AM] and Por p for [PM]: p
You entered an INVALID time!
7.) Input time based on a 12-hour clock: 1145
Input A or a for [AM] and Por p for [PM]: 5
You entered an INVALID time!
Transcribed Image Text:2.) Create a MATLAB program (using if-elseif-else) that will input time based on a 12-hour clock and output its corresponding value based on a 24-hour dlock. Display an error message if the time entered is invalid. Time based on a 12-hour clock Time based on a 24-hour clock 1:00 – 11:59 AM 1:00 -11:59 12:00 12:59 AM 0:00 – 0:59 12:00 – 12:59 PM 12:00 – 12:59 1:00 – 11:59 PM 13:00 – 23:59 Sample Output: 1.) Input time based on a 12-hour clock: 658 Input A or a for [AM] and P or p for [PM]: A You entered 6:58 AM The equivalent time based on a 24-hour clock is 6:58 2.) Input time based on a 12-hour clock: 1201 Input A or a for [AM] and P or p for [PM]: A You entered 12:01 AM The equivalent time based on a 24-hour clock is 0:01 3.) Input time based on a 12-hour clock: 1251 Input A or a for [AM] and P or p for [PM]: p You entered 12:51 PM The equivalent time based on a 24-hour clock is 12:51 4.) Input time based on a 12-hour clock: 809 Input A or a for [AM] and Por p for [PM]: P You entered 8:09 PM The equivalent time based on a 24-hour clock is 20:09 5.) Input time based on a 12-hour clock: 1601 Input A or a for [AM] and P or p for [PM]: A You entered an INVALID time! 6.) Input time based on a 12-hour clock: 1089 Input A or a for [AM] and Por p for [PM]: p You entered an INVALID time! 7.) Input time based on a 12-hour clock: 1145 Input A or a for [AM] and Por p for [PM]: 5 You entered an INVALID time!
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY