枚 举

package com.fuyou.effect;

// Enum type with data and behavior - Pages 149-150
public enum Planet {
MERCURY(3.302e+23, 2.439e6),
VENUS(4.869e+24, 6.052e6),
EARTH(5.975e+24,6.378e6),
MARS(6.419e+23, 3.393e6),
JUPITER(1.899e+27, 7.149e7),
SATURN( 5.685e+26, 6.027e7),
URANUS(8.683e+25, 2.556e7),
NEPTUNE(1.024e+26, 2.477e7);
private final double mass; // In kilograms
private final double radius; // In meters
private final double surfaceGravity; // In m / s^2
// Universal gravitational constant in m^3 / kg s^2
private static final double G = 6.67300E-11;

// Constructor
Planet(double mass, double radius) {
this.mass = mass;
this.radius = radius;
surfaceGravity = G * mass / (radius * radius);
}

public double mass() {
return mass;
}

public double radius() {
return radius;
}

public double surfaceGravity() {
return surfaceGravity;
}

public double surfaceWeight(double mass) {
return mass * surfaceGravity; // F = ma
}
}


// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: Planet.java

package com.fuyou.effect;


public final class Planet extends Enum
{

private Planet(String s, int i, double mass, double radius)
{
super(s, i);
this.mass = mass;
this.radius = radius;
surfaceGravity = (6.6729999999999999E-011D * mass) / (radius * radius);
}

public double mass()
{
return mass;
}

public double radius()
{
return radius;
}

public double surfaceGravity()
{
return surfaceGravity;
}

public double surfaceWeight(double mass)
{
return mass * surfaceGravity;
}

public static Planet[] values()
{
Planet aplanet[];
int i;
Planet aplanet1[];
System.arraycopy(aplanet = ENUM$VALUES, 0, aplanet1 = new Planet[i = aplanet.length], 0, i);
return aplanet1;
}

public static Planet valueOf(String s)
{
return (Planet)Enum.valueOf(com/fuyou/effect/Planet, s);
}

public static final Planet MERCURY;
public static final Planet VENUS;
public static final Planet EARTH;
public static final Planet MARS;
public static final Planet JUPITER;
public static final Planet SATURN;
public static final Planet URANUS;
public static final Planet NEPTUNE;
private final double mass;
private final double radius;
private final double surfaceGravity;
private static final double G = 6.6729999999999999E-011D;
private static final Planet ENUM$VALUES[];

static
{
MERCURY = new Planet("MERCURY", 0, 3.3019999999999999E+023D, 2439000D);
VENUS = new Planet("VENUS", 1, 4.8690000000000001E+024D, 6052000D);
EARTH = new Planet("EARTH", 2, 5.9749999999999999E+024D, 6378000D);
MARS = new Planet("MARS", 3, 6.4189999999999996E+023D, 3393000D);
JUPITER = new Planet("JUPITER", 4, 1.899E+027D, 71490000D);
SATURN = new Planet("SATURN", 5, 5.6849999999999998E+026D, 60270000D);
URANUS = new Planet("URANUS", 6, 8.6830000000000001E+025D, 25560000D);
NEPTUNE = new Planet("NEPTUNE", 7, 1.0239999999999999E+026D, 24770000D);
ENUM$VALUES = (new Planet[] {
MERCURY, VENUS, EARTH, MARS, JUPITER, SATURN, URANUS, NEPTUNE
});
}
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值