
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
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!](https://content.bartleby.com/qna-images/question/de702f38-7fde-44af-886e-4a8304a40d8f/11802977-f9c2-4f93-bde2-83873bf0495b/ek3zly5_thumbnail.jpeg)
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

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps

Knowledge Booster
Similar questions
- Create a script file in matlab to compute the cost of a pizza based on these parameters Ask the customer for the pizza size (8,10,14 inch) using input statement Ask the number of toppings using input statement. Just the number, not types. Compute the area of the pizza Compute the cost of the pizza - do not use “if” statements It costs 5 cents per square inch of pizza Add 5 cents per square inch for each topping Example; a plain pizza with 0 toppings costs $0.05* Area; A pizza with 2 toppings is that price + 0.05*Area*2 (I didn’t say it was a good pricing model!) Using an fprintf statement report to the customer “You ordered a ## inch pizza with ## toppings” “Your order will be $ ###.##” Using a display statement report “Thank you for your order” Add complexity by adding a spaghetti bowl for $6 and a ravioli bowl for $8. Ask the customer for how many orders of each of the dishes Compute the total cost Report to the customer with a longer message “You ordered a ## inch…arrow_forwardPlease provide workable code in python and show the outputarrow_forward1. Given below a solid cone of height h and base radius r mounted over a solid hemisphere of radius r. Write a MATLAB program to take input value of h and r from user and print the volume of solid figure in output.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

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 Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

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
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY