Homework 2 (Star Chart) FAQ
Q: What is the exact ordering I am supposed to use in my
A: The star with the smaller z goes earlier in the ordering. (i.e., if
this.z < other.z, then
this.compareTo(other) < 0.)
If the z-positions are the same, then the one with the smaller y goes earlier in the ordering.
If the z and y-positions are the same, then the one with the smaller x goes earlier in the ordering.
If the z, y, and x-positions are the same, then the one with the smaller magnitude goes earlier in the ordering.
If all values are the same, they are equal.
Q: The spec says that the stars should be circles/ovals, but in the expected output they look like squares. Which is correct?
A: Use rectangles (
Q: I am setting the star colors correctly, but all of my stars look slightly too dark/dim compared to the expected output. Why?
A: You may be drawing the stars as ovals. Use rectangles (
Q: Why does my code crash when I try to add things to a
BiMap does not tolerate duplicate keys or duplicate values.
You are probably trying to add a key/value pair that is a duplicate (such as a
You probably should not add that particular pair to that collection, and should store that data in some other way.
Q: The spec says I should not loop over data to search it, but how else can I implement a supernova?
A: You may loop over your stars to figure out which ones to explode in a supernova. That is fine.
Q: My graphical output does not match exactly! Will I lose points?
A: It is very hard to match graphical output exactly because of small differences between operating systems.
Our outputs were taken on Windows 7. Mac and Linux do not draw text using the exact same font when you call
In general your stars and constellation lines should match exactly but any text you write may not match exactly.
This is okay.
Q: When there is a supernova, if a star in the blast radius is already dead, should it count toward the total that is returned?
A: No; count only the "live" stars that are destroyed by the blast.
Q: When I have a supernova, my count of stars that are destroyed is off by 1. Why?
A: Maybe you are counting the actual star-that-goes-supernova too many/few times in your total.
Q: My graphical output is different by 300 to 400 pixels or so. Is that okay? How many pixels can differ?
A: Sometimes it's due to some small thing like the order in which you draw your stars.
Changing from a list to a set, or from a Hash__ to a Tree__ or vice versa and so on, can affect the order.
You generally don't need to worry about this.
If you slide the slider back and forth from "expected" to "actual" and can't really tell a difference when looking carefully, you are just fine and won't lose points for your graphical output.
Q: What do all of those extra numbers in the
stars.txt input file mean?
A: Each line has the star's x/y/z coordinates, along with two star ID numbers (a "Henry Draper number" and a "Harvard Revised number"), the star's magnitude, and its name if any.
You don't have to worry about this because the provided
Main program parses the file and creates the stars for you.
Q: When I try to turn in my program, I get compiler errors about symbol
DrawingPanel not found. Why?
A: You should not be constructing a new
DrawingPanel in your
StarChart class. The provided
Main program does that.
This document and its content are copyright © Marty Stepp, 2013. All rights reserved.
Any redistribution, reproduction, transmission, or storage of part or all of the contents in any form
is prohibited without the author's expressed written permission.