Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- public class KeplerLabFinal {
- public KeplerLabFinal(String name, double mass, double semiMajorAxis){
- this.getPlanetName = name;
- this.getPlanetMass = mass;
- this.getSemiMajorAxis = semiMajorAxis;
- }
- public static void main(String[] args){
- ArrayList<KeplerLabFinal> planets = new ArrayList<>();
- planets.add(new KeplerLabFinal("Mercury", 3.285e23, 0.38710));
- planets.add(new KeplerLabFinal("Venus", 4.867e24, 0.72333));
- planets.add(new KeplerLabFinal("Earth", 5.972e24, 1));
- planets.add(new KeplerLabFinal("Mars", 6.39e23, 1.52366));
- planets.add(new KeplerLabFinal("Jupiter", 1.898e27, 5.20336));
- planets.add(new KeplerLabFinal("Saturn", 5.683e26, 9.53707));
- planets.add(new KeplerLabFinal("Uranus", 8.681e25, 19.1913));
- planets.add(new KeplerLabFinal("Neptune", 1.024e26, 30.0690));
- planets.add(new KeplerLabFinal("Pluto", 1.309e22, 39.4821));
- for(KeplerLabFinal planet : planets){
- if(planet.getSemiMajorAxis >= 2 && planet.getSemiMajorAxis <= 15){
- System.out.println(planet.getPlanetName);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement