Cody

# Problem 44882. Opposite point of the earth, what is the antipodal of a point ?

Solution 1793900

Submitted on 20 Apr 2019
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   Fail
%Mathworks headquarters lat = '42.3 N'; long = '71.37 W'; [lat_o long_o]=opposite_earth_point(lat,long); lat_o_correct = '42.3 S'; long_o_correct = '108.63 E'; assert(isequal([lat_o long_o],[lat_o_correct long_o_correct]))

lat = '42.3 S' h = 2×1 cell array {'71.37'} {'W' } h = 2×1 cell array {1×5 double} {'W' } h = 2×1 cell array {1×5 double} {'E' }

Error using join (line 60) First argument must be a string array, character vector, or cell array of character vectors. Error in opposite_earth_point (line 14) long_o = join([h(1), h(2)]); Error in Test1 (line 4) [lat_o long_o]=opposite_earth_point(lat,long);

2   Fail
%San Antonio lat = '29.31 N'; long = '98.46 W'; [lat_o long_o]=opposite_earth_point(lat,long); lat_o_correct = '29.31 S'; long_o_correct= '81.54 E'; assert(isequal([lat_o long_o],[lat_o_correct long_o_correct]))

lat = '29.31 S' h = 2×1 cell array {'98.46'} {'W' } h = 2×1 cell array {1×5 double} {'W' } h = 2×1 cell array {1×5 double} {'E' }

Error using join (line 60) First argument must be a string array, character vector, or cell array of character vectors. Error in opposite_earth_point (line 14) long_o = join([h(1), h(2)]); Error in Test2 (line 4) [lat_o long_o]=opposite_earth_point(lat,long);

3   Fail
%My city lat = '32.9 S'; long = '68.82 W'; [lat_o long_o]=opposite_earth_point(lat,long); lat_o_correct= '32.9 N'; long_o_correct = '111.18 E'; assert(isequal([lat_o long_o],[lat_o_correct long_o_correct]))

lat = '32.9 N' h = 2×1 cell array {'68.82'} {'W' } h = 2×1 cell array {1×5 double} {'W' } h = 2×1 cell array {1×5 double} {'E' }

Error using join (line 60) First argument must be a string array, character vector, or cell array of character vectors. Error in opposite_earth_point (line 14) long_o = join([h(1), h(2)]); Error in Test3 (line 4) [lat_o long_o]=opposite_earth_point(lat,long);

4   Fail
%Big Ben lat = '51.5 N'; long = '0.12 W'; [lat_o long_o]=opposite_earth_point(lat,long); lat_o_correct= '51.5 S'; long_o_correct = '179.88 E'; assert(isequal([lat_o long_o],[lat_o_correct long_o_correct]))

lat = '51.5 S' h = 2×1 cell array {'0.12'} {'W' } h = 2×1 cell array {1×4 double} {'W' } h = 2×1 cell array {1×4 double} {'E' }

Error using join (line 60) First argument must be a string array, character vector, or cell array of character vectors. Error in opposite_earth_point (line 14) long_o = join([h(1), h(2)]); Error in Test4 (line 4) [lat_o long_o]=opposite_earth_point(lat,long);

5   Fail
%Wellington lat = '41.27 S'; long = '174.78 E'; [lat_o long_o]=opposite_earth_point(lat,long); lat_o_correct= '41.27 N'; long_o_correct = '5.22 W'; assert(isequal([lat_o long_o],[lat_o_correct long_o_correct]))

lat = '41.27 N' h = 2×1 cell array {'174.78'} {'E' } h = 2×1 cell array {1×6 double} {'E' } h = 2×1 cell array {1×6 double} {'W' }

Error using join (line 60) First argument must be a string array, character vector, or cell array of character vectors. Error in opposite_earth_point (line 14) long_o = join([h(1), h(2)]); Error in Test5 (line 4) [lat_o long_o]=opposite_earth_point(lat,long);

6   Fail
%Some point of Brasil lat = '1 S'; long = '50 W'; [lat_o long_o]=opposite_earth_point(lat,long); lat_o_correct= '1 N'; long_o_correct = '130 E'; assert(isequal([lat_o long_o],[lat_o_correct long_o_correct]))

lat = '1 N' h = 2×1 cell array {'50'} {'W' } h = 2×1 cell array {1×2 double} {'W' } h = 2×1 cell array {1×2 double} {'E' }

Error using join (line 60) First argument must be a string array, character vector, or cell array of character vectors. Error in opposite_earth_point (line 14) long_o = join([h(1), h(2)]); Error in Test6 (line 4) [lat_o long_o]=opposite_earth_point(lat,long);

7   Fail
% Some point near to Moscú lat = '55 N'; long = '37 E'; [lat_o long_o]=opposite_earth_point(lat,long); lat_o_correct= '55 S'; long_o_correct = '143 W'; assert(isequal([lat_o long_o],[lat_o_correct long_o_correct]))

lat = '55 S' h = 2×1 cell array {'37'} {'E' } h = 2×1 cell array {1×2 double} {'E' } h = 2×1 cell array {1×2 double} {'W' }

Error using join (line 60) First argument must be a string array, character vector, or cell array of character vectors. Error in opposite_earth_point (line 14) long_o = join([h(1), h(2)]); Error in Test7 (line 4) [lat_o long_o]=opposite_earth_point(lat,long);