-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSnowFlake.java
64 lines (56 loc) · 1.84 KB
/
SnowFlake.java
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//==============================================================================================\\
//=11/20/2015 AlexanderAlava=\\
//=SnowFlake.java Isaac Roberts=\\
//= =\\
//= This program is an abstract class that defines some of the methods that will be used by =\\
//= SnowBallFactory.java and also by all the snow flakes classes, including the melt method =\\
//==============================================================================================\\
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Random;
public abstract class SnowFlake
{
//Declaring variables and a NumberFormat object\\
private int type;
private double diameter;
private double radius;
static final double meltModifier = 0.05;
static double snowFall;
static Random gen = SnowBallFactory.gen;
static NumberFormat fmt = new DecimalFormat("#.####");
//Getters\\
public int getType()
{
return type;
}
public double getDiameter()
{
return diameter;
}
public double getRadius()
{
return radius;
}
//Setters\\
public void setType(int t)
{
type = t;
}
public void setDiameter(double d)
{
diameter = d;
}
public void setRadius()
{
radius = diameter/2;
}
//toString method\\
public String toString()
{
return "Type: " + type
+ "\nDiameter: " + fmt.format(diameter)
+ "\nRadius: " + fmt.format(radius);
}
//Abstract melt method without a body that will be defined in each snow flake class\\
abstract void melt();
}