diff --git a/MyFirstUniverse/src/com/company/cosmicbody/Planet.java b/MyFirstUniverse/src/com/company/cosmicbody/Planet.java index 12b70c4..8f82886 100644 --- a/MyFirstUniverse/src/com/company/cosmicbody/Planet.java +++ b/MyFirstUniverse/src/com/company/cosmicbody/Planet.java @@ -1,103 +1,103 @@ -package com.company.cosmicbody; - -public class Planet extends CosmicBody { - private String name; - private double weight; - private double diameter; - private double gravitation; - private Boolean weightSet = false; - - public void setPlanetaryWeight(double weight){ - if(!weightSet){ - setWeight(weight); - weightSet = true; - } - } - - - public double getWeight() { - return weight; - } - - private void setWeight(double weight) { - if(this.weight>weight){ - if(Math.abs(this.weight-weight) <= 1000){ - System.out.println("I'm losing weight."); - } - else { - System.out.println("I am very poor."); - } - } - else{ - if(Math.abs(this.weight-weight) <= 1000){ - System.out.println("Damn, I woke up."); - } - else { - System.out.println("Damn, I put on too much weight."); - } - } - - if(Math.abs(this.weight-weight)>1000){ - increaseGravity(0.1); - } else { - decreaseGravity(0.1); - } - - this.weight = weight; - } - - public double getDiameter() { - return diameter; - } - - private void setDiameter(double diameter) { - this.diameter = diameter; - } - - public String getName() { - return name; - } - - private void setName(String name) { - this.name = name; - } - - public double getGravitation() { - return gravitation; - } - - public void setGravitation(double gravitation) { - this.gravitation = gravitation; - } - - public Planet(String name, double weight, double diameter) { -// setWeight(weight); -// setDiameter(diameter); -// setName(name); - this.name = name; - this.weight = weight; - this.diameter = diameter; - this.gravitation = 9.81; - } - - private void increaseGravity(double add){ - gravitation = gravitation + add; - } - private void decreaseGravity(double dec){ - gravitation = gravitation - dec; - } - - public Planet(String name, double weight, double diameter, double gravitation) { - this.name = name; - this.weight = weight; - this.diameter = diameter; - this.gravitation = gravitation; - } - -// public Planet() { -// this.name = "Zem"; -// this.weight = 5972200; -// this.diameter = 12756; -// } - -} +package com.company.cosmicbody; + +public class Planet extends CosmicBody { + private String name; + private double weight; + private double diameter; + private double gravitation; + private Boolean weightSet = false; + + public void setPlanetaryWeight(double weight){ + if(!weightSet){ + setWeight(weight); + weightSet = true; + } + } + + + public double getWeight() { + return weight; + } + + private void setWeight(double weight) { + if(this.weight>weight){ + if(Math.abs(this.weight-weight) <= 1000){ + System.out.println("I'm losing weight."); + } + else { + System.out.println("I'm losing a lot of weight."); + } + } + else{ + if(Math.abs(this.weight-weight) <= 1000){ + System.out.println("Damn, I woke up."); + } + else { + System.out.println("Damn, I put on too much weight."); + } + } + + if(Math.abs(this.weight-weight)>1000){ + increaseGravity(0.1); + } else { + decreaseGravity(0.1); + } + + this.weight = weight; + } + + public double getDiameter() { + return diameter; + } + + private void setDiameter(double diameter) { + this.diameter = diameter; + } + + public String getName() { + return name; + } + + private void setName(String name) { + this.name = name; + } + + public double getGravitation() { + return gravitation; + } + + public void setGravitation(double gravitation) { + this.gravitation = gravitation; + } + + public Planet(String name, double weight, double diameter) { +// setWeight(weight); +// setDiameter(diameter); +// setName(name); + this.name = name; + this.weight = weight; + this.diameter = diameter; + this.gravitation = 9.81; + } + + private void increaseGravity(double add){ + gravitation = gravitation + add; + } + private void decreaseGravity(double dec){ + gravitation = gravitation - dec; + } + + public Planet(String name, double weight, double diameter, double gravitation) { + this.name = name; + this.weight = weight; + this.diameter = diameter; + this.gravitation = gravitation; + } + +// public Planet() { +// this.name = "Zem"; +// this.weight = 5972200; +// this.diameter = 12756; +// } + +}