small changes
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -14,7 +14,7 @@ local.properties
|
|||||||
.settings/
|
.settings/
|
||||||
.loadpath
|
.loadpath
|
||||||
.recommenders
|
.recommenders
|
||||||
|
META-INF/
|
||||||
# External tool builders
|
# External tool builders
|
||||||
.externalToolBuilders/
|
.externalToolBuilders/
|
||||||
|
|
||||||
@@ -122,3 +122,4 @@ https://github.com/joeblau/gitignore.io/issues/360
|
|||||||
.idea/
|
.idea/
|
||||||
*.iml
|
*.iml
|
||||||
# End of https://www.gitignore.io/api/eclipse,intellij+all
|
# End of https://www.gitignore.io/api/eclipse,intellij+all
|
||||||
|
out/
|
||||||
|
@@ -1,6 +1,21 @@
|
|||||||
|
import java.io.Console;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("Hello World!");
|
System.out.println("Hello World!");
|
||||||
|
Console console = System.console();
|
||||||
|
double input = Double.parseDouble(console.readLine("Enter your %d (th) passport number: ", 2));
|
||||||
|
System.out.println(input);
|
||||||
|
System.out.println((int)input);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static int minRadius = 50;
|
||||||
|
private static double radius;
|
||||||
|
public static void setRadius(double radius2) {
|
||||||
|
if (radius2 < minRadius) {
|
||||||
|
throw new IllegalArgumentException("Radius is smaller than " + minRadius);
|
||||||
|
}
|
||||||
|
radius = radius2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -10,7 +10,7 @@ public class Worm {
|
|||||||
|
|
||||||
// shape
|
// shape
|
||||||
private double radius;
|
private double radius;
|
||||||
private double minRadius;
|
private final double minRadius;
|
||||||
// mass
|
// mass
|
||||||
private double mass;
|
private double mass;
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ public class Worm {
|
|||||||
|
|
||||||
public void setRadius(double radius) {
|
public void setRadius(double radius) {
|
||||||
if (radius < this.minRadius) {
|
if (radius < this.minRadius) {
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException("Radius is smaller than " + this.minRadius);
|
||||||
}
|
}
|
||||||
this.radius = radius;
|
this.radius = radius;
|
||||||
setMass(radius);
|
setMass(radius);
|
||||||
@@ -114,10 +114,6 @@ public class Worm {
|
|||||||
return this.minRadius;
|
return this.minRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMinRadius(double minRadius) {
|
|
||||||
this.minRadius = minRadius;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getMass() {
|
public double getMass() {
|
||||||
return this.mass;
|
return this.mass;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user