Problem Statement  
The motion of planets is relatively simple to simulate using computers. Newton's laws of gravity allow us to model this motion, so long as we know the masses, initial positions, and initial velocities of all the planets involved. There are four basic laws of physics that you need to perform this simulation. In all of these laws, force, acceleration, and velocity are threedimensional vectors, meaning they have x, y and z components.The first law is F = ma where F stands for force, m stands for mass, and a stands for acceleration. The second law is F = (G*m_{1}*m_{2})/(d^2), where F again stands for force, m_{1} and m_{2} stand for the masses of some object 1 and object 2, d stands for the distance between object 1 and object 2, and G is a numerical constant. Third is pos_{f} = pos_{i} + v*t where pos_{i} is the initial position, pos_{f} is the final position, v is the velocity, and t is the time. Lastly, v_{f} = v_{i} + at, where v_{f} is the final velocity, v_{i} is the initial velocity, a stands for acceleration, and t stands for the time that the objects are accelerating. So, if there are a number of planets, there is some force between each pair of planets, as defined by the second law. The direction of the force between two planets is always in the direction from one planet to the other. The total force on a planet is thus the vector sum of all of the individual forces on the planet. Note that the vector sum takes the directions of the forces into account. From this, we can use the first law given to find the acceleration of each planet (acceleration is always in the same direction as the force). Then, by using some small time interval, we can repeatedly move each planet and adjust its velocity. Thus, the algorithm to model the motion of planets for one time interval t is: foreach (planet p){ F = vector sum over all p'!=p of ( G*m[p]*m[p']/(dist(p,p')^2) ) v[p] = v[p] + F/m[p] * t; } foreach (planet p){ pos[p] = pos[p] + v[p]*t; }In other words, for each planet, we first compute and apply its change in velocity based on the locations of the other planets, and then we move the planet based on the new velocity. In this problem, we will be using a constant of G = 6.673*(10^11), and t = 3600 (this represents one hour). You will be given a String[], planets, each of whose elements represents a planet. Each element of planets will be formatted as "<x position> <y position> <z position> <x velocity> <y velocity> <z velocity> <mass>". You will also be given an int, time, representing how many times to move the planets. You are to return a String[] each of whose elements represents the location of a planet (in the same order they are given to you), and is formatted as "<x position> <y position> <z position>". Each <position> in the return should be in scientific notation, formatted as "D.DDDEN" or "D.DDDEN", where each 'D' represents a digit, 'E' is just a single letter, and 'N' is the appropriate exponent with no extra leading zeros ('N' should never be less than zero, so 0.002 should be formatted as 0.002E0, not 2.000E3). The final (fourth) 'D' should be rounded (.5 rounds up). For example, 12435000 would be formatted as "1.244E7", while 12434999 would be formatted as "1.243E7" and 1.0625 would be formatted as "1.062E0"  
Definition  
 
Notes  
  Planets should be treated as points, and we will not worry about the possibility of collisions.  
  Be careful not to return "0.000E0". If the actual number is 0.000000001, you should return "0.000E0".  
  All calculations should be done using the 64 bit double type.  
Constraints  
  Each element of planets will be formatted as "<x position> <y position> <z position> <x velocity> <y velocity> <z velocity> <mass>", where each term is a real valued number.  
  Each real number will be a <real> conforming to the following grammar:
 
  time will be between 1 and 100, inclusive.  
  planets will contain between 2 and 5 elements, inclusive.  
  Each element of planets will contain between 13 and 50 characters, inclusive.  
  Each <position> will be between 1E100 and 1E100.  
  Each <velocity> will be between 1E20 and 1E20.  
  Each <mass> will be between 1 and 1E50, inclusive.  
  To prevent rounding errors, the formatted result will not be affected by relative or absolute errors up to 1e6.  
  No two planets will ever be within 1000 units of each other during any time step. However, this does not mean that two planets may not jump through each other (see example 2).  
  To further ensure that there are no rounding errors, the result obtained using doubles will match the result using very precise calculations (using the BigDecimal class in Java).  
Examples  
0)  
 
1)  
 
2)  
 
3)  
 
4)  
 
5)  
