-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGravUniverseReader.java
More file actions
43 lines (38 loc) · 1.44 KB
/
GravUniverseReader.java
File metadata and controls
43 lines (38 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* Class for reading in a file of two dimensional circular bodies for
* gravity simulations.
* @author Sean Stern
* @version 1.0
*/
public class GravUniverseReader extends UniverseReader{
/**
* Reads a gravitational simulation universe from a file.
*
* @param fileName the file that contains the gravity simulation data in
* the following format:
*
* [integer n representing number of bodies in universe]\n
* [real number r representing the radius of the universe]\n
* [real number x-coordinate of body]
* [real number y-coordinate of body]
* [real number x-velocity of body]
* [real number y-velocity of body]
* [real number mass of body]
* [integer red-value using 0-255 RGB color scale]
* [integer green-value using 0-255 RGB color scale]
* [integer blue-value using 0-255 RGB color scale]\n
*/
public GravUniverseReader(String fileName){
In input = new In(fileName);
// TODO: Read in data from file according to format
// TODO: Initialize parent class's protected instance variables
// with data read from file
}
public static void main(String[] args){
// TODO: Write simple test of GravUniverseReader here by
// constructing a GravUniverseReader object and calling
// the two inherited methods on the GravUniverseReader object.
// Then print out the information returned from these methods
// to verify that they worked correctly.
}
}