Cody

# Problem 392. Clock Hand Angle 1

Solution 1837789

Submitted on 4 Jun 2019 by John Simpson
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
assert(abs(handAngle('12:00:00')-0) < 1e-9)

HH_string = '12' MM_string = '00' SS_string = '00' HH = 12 MM = 0 SS = 0 HH_total = 12 theta_HH = 360 MM_total = 0 theta_MM = 0 theta_one = 360 theta = 0

2   Pass
assert(abs(handAngle('03:28:07')-64.6416666667) < 1e-9)

HH_string = '03' MM_string = '28' SS_string = '07' HH = 3 MM = 28 SS = 7 HH_total = 3.4686 theta_HH = 104.0583 MM_total = 28.1167 theta_MM = 168.7000 theta_one = 64.6417 theta = 64.6417

3   Pass
assert(abs(handAngle('12:26:23')-145.1083333333) < 1e-9)

HH_string = '12' MM_string = '26' SS_string = '23' HH = 12 MM = 26 SS = 23 HH_total = 12.4397 theta_HH = 373.1917 MM_total = 26.3833 theta_MM = 158.3000 theta_one = 214.8917 theta = 145.1083

4   Pass
assert(abs(handAngle('09:50:12')-6.1000000000) < 1e-9)

HH_string = '09' MM_string = '50' SS_string = '12' HH = 9 MM = 50 SS = 12 HH_total = 9.8367 theta_HH = 295.1000 MM_total = 50.2000 theta_MM = 301.2000 theta_one = 6.1000 theta = 6.1000

5   Pass
assert(abs(handAngle('07:06:30')-174.2500000000) < 1e-9)

HH_string = '07' MM_string = '06' SS_string = '30' HH = 7 MM = 6 SS = 30 HH_total = 7.1083 theta_HH = 213.2500 MM_total = 6.5000 theta_MM = 39 theta_one = 174.2500 theta = 174.2500

6   Pass
assert(abs(handAngle('06:08:21')-134.0750000000) < 1e-9)

HH_string = '06' MM_string = '08' SS_string = '21' HH = 6 MM = 8 SS = 21 HH_total = 6.1392 theta_HH = 184.1750 MM_total = 8.3500 theta_MM = 50.1000 theta_one = 134.0750 theta = 134.0750

7   Pass
assert(abs(handAngle('01:11:58')-35.8166666667) < 1e-9)

HH_string = '01' MM_string = '11' SS_string = '58' HH = 1 MM = 11 SS = 58 HH_total = 1.1994 theta_HH = 35.9833 MM_total = 11.9667 theta_MM = 71.8000 theta_one = 35.8167 theta = 35.8167

8   Pass
assert(abs(handAngle('09:24:56')-132.8666666667) < 1e-9)

HH_string = '09' MM_string = '24' SS_string = '56' HH = 9 MM = 24 SS = 56 HH_total = 9.4156 theta_HH = 282.4667 MM_total = 24.9333 theta_MM = 149.6000 theta_one = 132.8667 theta = 132.8667

9   Pass
assert(abs(handAngle('01:50:04')-114.6333333333) < 1e-9)

HH_string = '01' MM_string = '50' SS_string = '04' HH = 1 MM = 50 SS = 4 HH_total = 1.8344 theta_HH = 55.0333 MM_total = 50.0667 theta_MM = 300.4000 theta_one = 245.3667 theta = 114.6333

10   Pass
assert(abs(handAngle('01:49:45')-116.3750000000) < 1e-9)

HH_string = '01' MM_string = '49' SS_string = '45' HH = 1 MM = 49 SS = 45 HH_total = 1.8292 theta_HH = 54.8750 MM_total = 49.7500 theta_MM = 298.5000 theta_one = 243.6250 theta = 116.3750

11   Pass
assert(abs(handAngle('07:04:17')-173.5583333333) < 1e-9)

HH_string = '07' MM_string = '04' SS_string = '17' HH = 7 MM = 4 SS = 17 HH_total = 7.0714 theta_HH = 212.1417 MM_total = 4.2833 theta_MM = 25.7000 theta_one = 186.4417 theta = 173.5583

12   Pass
assert(abs(handAngle('02:24:26')-74.3833333333) < 1e-9)

HH_string = '02' MM_string = '24' SS_string = '26' HH = 2 MM = 24 SS = 26 HH_total = 2.4072 theta_HH = 72.2167 MM_total = 24.4333 theta_MM = 146.6000 theta_one = 74.3833 theta = 74.3833

13   Pass
assert(abs(handAngle('10:32:33')-120.9750000000) < 1e-9)

HH_string = '10' MM_string = '32' SS_string = '33' HH = 10 MM = 32 SS = 33 HH_total = 10.5425 theta_HH = 316.2750 MM_total = 32.5500 theta_MM = 195.3000 theta_one = 120.9750 theta = 120.9750

14   Pass
assert(abs(handAngle('10:26:57')-151.7750000000) < 1e-9)

HH_string = '10' MM_string = '26' SS_string = '57' HH = 10 MM = 26 SS = 57 HH_total = 10.4492 theta_HH = 313.4750 MM_total = 26.9500 theta_MM = 161.7000 theta_one = 151.7750 theta = 151.7750

15   Pass
assert(abs(handAngle('09:40:26')-47.6166666667) < 1e-9)

HH_string = '09' MM_string = '40' SS_string = '26' HH = 9 MM = 40 SS = 26 HH_total = 9.6739 theta_HH = 290.2167 MM_total = 40.4333 theta_MM = 242.6000 theta_one = 47.6167 theta = 47.6167

16   Pass
assert(abs(handAngle('02:38:59')-154.4083333333) < 1e-9)

HH_string = '02' MM_string = '38' SS_string = '59' HH = 2 MM = 38 SS = 59 HH_total = 2.6497 theta_HH = 79.4917 MM_total = 38.9833 theta_MM = 233.9000 theta_one = 154.4083 theta = 154.4083

17   Pass
assert(abs(handAngle('08:18:19')-139.2583333333) < 1e-9)

HH_string = '08' MM_string = '18' SS_string = '19' HH = 8 MM = 18 SS = 19 HH_total = 8.3053 theta_HH = 249.1583 MM_total = 18.3167 theta_MM = 109.9000 theta_one = 139.2583 theta = 139.2583

18   Pass
assert(abs(handAngle('07:26:43')-63.0583333333) < 1e-9)

HH_string = '07' MM_string = '26' SS_string = '43' HH = 7 MM = 26 SS = 43 HH_total = 7.4453 theta_HH = 223.3583 MM_total = 26.7167 theta_MM = 160.3000 theta_one = 63.0583 theta = 63.0583

19   Pass
assert(abs(handAngle('12:01:40')-9.1666666667) < 1e-9)

HH_string = '12' MM_string = '01' SS_string = '40' HH = 12 MM = 1 SS = 40 HH_total = 12.0278 theta_HH = 360.8333 MM_total = 1.6667 theta_MM = 10 theta_one = 350.8333 theta = 9.1667

20   Pass
assert(abs(handAngle('08:60:33')-93.0250000000) < 1e-9)

HH_string = '08' MM_string = '60' SS_string = '33' HH = 8 MM = 60 SS = 33 HH_total = 9.0092 theta_HH = 270.2750 MM_total = 60.5500 theta_MM = 363.3000 theta_one = 93.0250 theta = 93.0250

21   Pass
assert(abs(handAngle('10:11:42')-124.3500000000) < 1e-9)

HH_string = '10' MM_string = '11' SS_string = '42' HH = 10 MM = 11 SS = 42 HH_total = 10.1950 theta_HH = 305.8500 MM_total = 11.7000 theta_MM = 70.2000 theta_one = 235.6500 theta = 124.3500

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!