Question: Complete the Stars class shown below. This program should only display stars whose magnitude is less than 5.0 and whose Z coordinate is greater than
Complete the Stars class shown below. This program should only display stars whose magnitude is less than 5.0 and whose Z coordinate is greater than zero. (Stars with a negative Z can only be seen in the southern hemisphere.) The background color of the sky is black, so you should set the color of the stars to something that will show. White works well. You will need to download the StarLab.jar file and tell jGRASP in Settings/ Classpath / workspace / Classpaths. The drawStars method must:


Constellations.txt:
-0.581457 -0.294806 -0.536543 -0.205755 -0.536543 -0.205755 -0.544292 -0.130741 -0.544292 -0.130741 -0.54293 -0.036595 -0.54293 -0.036595 -0.591873 0.015941 -0.591873 0.015941 -0.535916 0.138997 -0.535916 0.138997 -0.459109 0.115042 -0.54293 -0.036595 -0.459109 0.115042 0.010128 0.007897 -0.007201 -0.059107 -0.007201 -0.059107 -0.043974 -0.131365 -0.043974 -0.131365 -0.11818 -0.175304 -0.11818 -0.175304 -0.200728 -0.185075 -0.200728 -0.185075 -0.199642 -0.239467 -0.199642 -0.239467 -0.106414 -0.221875 -0.106414 -0.221875 -0.11818 -0.175304
stars.txt:
0.994772 0.023164 -0.099456 28 4.61 3 0.97249 0.024187 0.231685 87 5.55 4 0.435119 0.012234 0.90029 144 5.57 7 0.998442 0.033711 -0.044468 315 6.43 11 0.998448 0.035746 -0.042707 352 6.18 14 0.873265 0.031968 0.486196 358 2.07 15 0.512379 0.020508 0.858515 432 2.28 21 0.949168 0.037455 0.312534 448 5.57 22 0.882312 0.036017 -0.469285 493 5.42 24 0.69724 0.028641 -0.716265 496 3.88 25 0.980198 0.042952 0.193306 560 5.54 26 0.693047 0.031231 0.720216 571 5.01 27 0.135171 0.005924 -0.990805 636 5.29 30 0.962619 0.047354 -0.266689 693 4.89 33 0.883455 0.044652 -0.466383 720 5.41 34 0.816743 0.041844 -0.575482 739 5.24 35 0.963482 0.055705 0.261913 886 2.83 39 0.752989 0.044458 0.656529 905 5.71 41 0.936549 0.059751 0.345408 1013 4.79 45 0.943971 0.060384 -0.324457 1038 4.44 48 0.986062 0.064542 0.153349 1061 6.02 50 0.987091 0.071481 0.143323 1227 6.12 59 0.77846 0.058165 0.624993 1280 4.61 63 0.621566 0.048148 0.781881 1337 6.11 65 0.798325 0.063981 0.598819 1404 4.51 68 0.719465 0.058843 0.692032 1438 6.1 70 0.984616 0.083667 -0.153397 1522 3.56 74 0.422933 0.037061 -0.905403 1581 4.23 77 0.985806 0.088838 0.142461 1635 5.38 80 0.785002 0.072548 0.615231 1671 5.16 82 0.346752 0.031329 -0.937433 1685 5.5 83 0.870924 0.082019 -0.484524 1737 5.18 84 0.935111 0.089096 -0.342971 1760 5.61 85 0.96779 0.094996 0.233147 1796 6.25 86 0.972523 0.097324 -0.211488 1835 6.39 88 0.777474 0.08183 0.623569 1967 7.39 90 0.469314 0.050966 0.881559 2011 5.38 93 0.993294 0.110554 0.033848 2114 5.77 97 0.219231 0.024642 -0.975362 2151 2.82 98 0.734714 0.084623 -0.673078 2261 2.4 99 0.718488 0.082503 -0.690629 2262 3.93 100 0.99326 0.115903 -0.000864 2273 6.16 101 0.944514 0.11617 0.307242 2411 5.01 103 0.832385 0.10194 -0.544742 2429 4.86 105 0.951834 0.117762 0.283097 2436 6.05 106
COMP163 Star Chart Astronomers collect lots of data about stars and there are many catalogs that identify the locations of stars. In this assignment, you will use data in a star catalog to create a picture that plots the locations of stars The file stars.txt contains one line for each star that is represented in the catalog. The meaning of each field (column) is described below . The first three fields are the x, y and z coordinates for the star. Each axis in the coordinate system goes from -1 to +1, and the center point is 0,0. (See the figure below.) The fourth field is the Henry Draper number, which is simply a unique identifier for the star that is unnecessary for this program . The fifth field is the magnitude (or brightness) of the star. The smaller the number, the brighter the star The sixth field is Harvard Revised number, another identifier that is unnecessary for this program . Your program will have to read each data item in the file even if it will not be used. The coordinate system used for pixels in a picture has position (0,0) in the upper left corner of the picture, and the maximum x and y values are the height and width of the picture in pixels. In this assignment, al pictures will be square with a maximum height and width of 900 pixels. See below for a comparison of the two coordinate systems. 0,0 0, 900 5 -1 5 Pixel Coordinate System 0,0 -1 900, 0 Star Catalog Coordinate System The first step is to write a method that will convert from coordinate numbers to a pixel location. Note the same method will work for both X and Y coordinates. The method will have the header int coord2pixel( double coord)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
