Изменил(а) на 'MyFirstUniverse/src/com/company/cosmicbody/Planet.java'

This commit is contained in:
Oleksandr Hryshchenko 2022-11-07 22:19:10 +00:00
parent 8efe7417df
commit 98217560df

View File

@ -19,7 +19,7 @@ public class Planet extends CosmicBody {
return weight; return weight;
} }
private void setWeight(double weight) { public void setWeight(double weight) {
if(this.weight>weight){ if(this.weight>weight){
if(Math.abs(this.weight-weight) <= 1000){ if(Math.abs(this.weight-weight) <= 1000){
System.out.println("I'm losing weight."); System.out.println("I'm losing weight.");
@ -37,7 +37,7 @@ public class Planet extends CosmicBody {
} }
} }
if(Math.abs(this.weight-weight)>1000){ if(Math.abs(this.weight-weight) < 1000){
increaseGravity(0.1); increaseGravity(0.1);
} else { } else {
decreaseGravity(0.1); decreaseGravity(0.1);
@ -50,7 +50,7 @@ public class Planet extends CosmicBody {
return diameter; return diameter;
} }
private void setDiameter(double diameter) { public void setDiameter(double diameter) {
this.diameter = diameter; this.diameter = diameter;
} }
@ -58,7 +58,7 @@ public class Planet extends CosmicBody {
return name; return name;
} }
private void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }