Question: -All I really need is the written program, & that it should be written in java. It's due tonight, thanks. Starlab.jar: https://files.fm/u/uvyy22ww [85 points] Complete
-All I really need is the written program, & that it should be written in java. It's due tonight, thanks.
Starlab.jar: https://files.fm/u/uvyy22ww
[85 points] 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: Create a Scanner object to read the stars.txt file while hasNextDouble in stars.txt Read a line of data from the file Convert the coordinates to pixels Draw a 2 by 2 pixel rectangle for the star public class Stars { public void drawStars(java.awt.Graphics sky) throws java.io.FileNotFoundException { // Your program goes here } private int coord2pixel( double coord ) { // convert the coordinate location to pixels } public static void main(String[] args) { StarFrame window = new StarFrame(); } }
[5 points] Instead of displaying all stars as 2 by 2, modify your program to display a larger rectangle for brighter stars. The size of the star in pixels can be determined by (int)(5.0 - magnitude) + 1
[10 points] Add lines to your star chart to show some constellations. The file constellations.txt contains sets of four coordinates X1,Y1 and X2,Y2 that are the start and end point of lines defining constellations. The coordinates for the lines are in the same 0 to 1.0 scale as the star coordinates.

![be written in java. It's due tonight, thanks. Starlab.jar: https://files.fm/u/uvyy22ww [85 points]](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66effaabe184f_30766effaab45a64.jpg)
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 0.860696 0.11378 0.496242 2628 5.2 114 0.989059 0.130384 -0.069013 2637 5.72 117 0.394696 0.054453 0.917197 2729 6.18 121 0.574817 0.080202 0.814342 2772 4.74 123 0.652465 0.089998 -0.752456 2834 4.76 125 0.450343 0.062375 -0.890674 2884 4.36 126 0.450226 0.062386 -0.890733 2885 4.53 127 0.450342 0.065296 0.890465 2905 4.17 130 0.928456 0.132924 0.346845 2910 5.38 131 0.98274 0.139846 0.121097 2913 5.69 132 0.448886 0.064545 -0.891255 3003 5.07 136 0.390296 0.059053 0.918794 3038 6.47 137 0.317769 0.046623 -0.947021 3112 6.11 139 0.986257 0.152875 -0.062664 3196 5.2 142 0.987958 0.154471 -0.008822 3229 5.94 143 0.661027 0.103767 -0.743153 3302 5.51 147 0.581589 0.094643 0.807958 3360 3.69 153 0.82102 0.133273 0.555126 3369 4.34 154 0.952467 0.154217 0.262724 3379 5.89 155 0.859652 0.14601 0.489571 3546 4.34 163 0.845805 0.146577 0.51296 3627 3.27 165 0.918283 0.159309 0.36246 3651 5.88 166 0.916721 0.161337 0.365503 3690 5.36 167 0.542802 0.096948 0.834246 3712 2.24 168 0.759689 0.137785 0.635521 3817 5.3 175 0.625228 0.116062 0.771764 3901 4.8 179 0.682345 0.124392 -0.72037 3919 4.59 180 0.542774 0.100038 -0.8339 3980 5.72 183 0.669459 0.128518 0.731647 4058 4.95 184 0.769445 0.145092 -0.622016 4065 6.05 185 0.40809 0.076504 -0.909731 4089 5.38 187 0.933979 0.179802 -0.308796 4128 2.04 188 0.658321 0.129268 0.741554 4142 5.66 189 0.528248 0.101137 -0.843045 4150 4.36 191 0.253897 0.051254 0.965872 4161 5.64 192 0.652803 0.129036 0.746457 4180 4.48 193 0.964691 0.188348 -0.184111 4188 4.77 194 0.768931 0.150157 -0.621448 4211 5.9 195 0.955707 0.192177 -0.222915 4307 6.15 203 0.255731 0.054086 0.965234 4382 5.42 208 0.943933 0.194404 0.266828 4408 5.36 211 0.957723 0.199311 0.207467 4482 5.51 213 0.922249 0.192777 0.335101 4490 6.11 214 0.892258 0.186971 0.410996 4502 4.08 215 0.971928 0.203904 0.117381 4526 5.98 216 0.91371 0.193849 0.357151 4568 6.51 217 0.520462 0.113206 0.846347 4614 3.46 219 0.969959 0.20745 0.127063 4627 5.92 221 0.61551 0.133171 0.776796 4636 4.9 223 0.968971 0.208975 0.132 4656 4.44 224 0.934843 0.202882 0.291389 4676 5.07 225 0.736069 0.162555 0.657098 4727 4.53 226 0.864421 0.191183 0.465001 4757 5.55 230 0.864419 0.191189 0.465001 4758 7.1 231 0.959379 0.213254 -0.184702 4813 5.17 235 0.254288 0.05473 -0.965579 4815 5.09 236 0.614166 0.138086 -0.777002 4919 5.24 242 0.973177 0.229189 -0.019969 5112 4.78 248 0.341034 0.079374 -0.936694 5190 6.67 252 0.500672 0.122521 0.856923 5234 4.83 253 0.91778 0.222827 0.328676 5267 5.8 254 0.960782 0.231963 -0.15196 5268 6.15 255 0.88994 0.217631 0.400804 5286 5.46 258 0.862948 0.215058 0.457243 5382 6.08 262 0.47423 0.119797 0.872212 5394 2.15 264
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, all 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 -0.5 -0.5 0.5 0,0 Pixel Coordinate System -0.5 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
