Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

-All I really need is the written program, & that it should be written in java.

ID: 3603124 • Letter: #

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 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.

constellations.txt:

stars.txt:

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)

Explanation / Answer

4.0.0 com.skoerkamp groupplanner war 1.0-SNAPSHOT Group Planner Server http://maven.apache.org maven2-repository.java.net Java.net Repository for Maven http://download.java.net/maven/2/ default junit junit 4.8.2 test com.sun.jersey jersey-server 1.8 org.json json 20141113 javax.ws.rs jsr311-api 1.1.1 org.springframework spring-core 4.1.3.RELEASE org.springframework spring-context 4.1.3.RELEASE org.springframework spring-web 3.0.4.RELEASE org.springframework spring-beans 4.1.3.RELEASE org.springframework spring-tx 4.0.5.RELEASE org.springframework spring-orm 4.1.3.RELEASE org.springframework spring-jdbc 4.1.3.RELEASE mysql mysql-connector-java 5.1.24 org.hibernate hibernate-validator 5.1.3.Final org.hibernate hibernate-entitymanager 4.3.7.Final groupplanner org.apache.maven.plugins maven-compiler-plugin 3.2 1.7 1.7 maven-failsafe-plugin 2.6 integration-test verify org.mortbay.jetty maven-jetty-plugin 6.1.16 10 8005 STOP /groupplanner start-jetty pre-integration-test run 0 true stop-jetty post-integration-test stop package com.skoerkamp.rest; import com.skoerkamp.service.CalendarService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.ws.rs.GET; import javax.ws.rs.Path; @Path("/calendar") @Service public class CalendarEndpoint { @Autowired private CalendarService calendarService; @GET public String getCalendarItems() { calendarService.create(); return ""; } }