Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Matlab question 1. Write a script called \"timer\" that takes two inputs (minute

ID: 3734845 • Letter: M

Question

Matlab question

1. Write a script called "timer" that takes two inputs (minutes and seconds). The script should allow you to enter up to 99 minutes and up to 99 seconds. It will output 2 numbers, with minutes as the first number (two digits), followed by a colon (:), followed by seconds as the second number (also two digits). Although you can enter up to 99 seconds, the program should only return 0-59 seconds. So, if the user enters a number between 60 and 99 seconds, the program will add one to the number of minutes and subtract 60 from the number of seconds. Generate an error if there are more than 99 minutes. If the user tries to enter more ple pogzam witMATLA Test the program for 63 minutes, 82 seconds. (25 points).

Explanation / Answer

Code :

clear;
clc;
%prompt = 'Enter minutes: ';
minutes = 63;
if (minutes>99)
    fprintf("Minutes cannot be over 99.");
end
%prompt = 'Enter seconds: ';
seconds = 82;
if (seconds>99)
    fprintf("Seconds cannot be over 99.");
end
if(seconds > 59 && seconds < 99)
    minutes=minutes+1;
    seconds = seconds - 60;
end
fprintf("%d:%d ",minutes,seconds);