In: Computer Science
USE MATLAB
Given a clock on the planet 9 with hour, minute, and second hands, where day last 14 hours (hour hand circles twice for a day)
a) At what time (in hours), the first time after 0th hour, all 3 hands will overlap,
b) At what times (in hours) they will overlap between 0th hour and 7th hour?
In this problem let us relate earth to planet9.
compare
# EARTH PLANET 9 HOURS 24 14 CLOCK 12 7 OVERLAP 11 6So in planet 9, we will have 6 overlaps between 0th hour and 7th
hour. Therefore time difference would be 7/6 hours.
We will have 6 times overlapping in 7 hours.
Please see the output and code for better understanding.
****************************************************************************************
Code
function [] = overlap()
day_hours = 14;
clock = day_hours/2;
time_diff = clock/(clock-1);
disp(['The first time after 0th hour, all 3 hands will overlap at
',num2str(time_diff),' hours']);
disp(['Times (in hours) they will overlap between 0th hour and 7th
hour are:',num2str(time_diff)]);
overlap_time = 0;
for r = 1:clock-1
overlap_time = overlap_time + time_diff;
disp(['Time : ',num2str(overlap_time),' hours']);
end
end
************************************************************************
OUTPUTS: