From 8efe7417df08c55033eb64a3e621d3f4d731b109 Mon Sep 17 00:00:00 2001 From: Oleksandr Hryshchenko Date: Mon, 7 Nov 2022 22:14:20 +0000 Subject: [PATCH] =?UTF-8?q?=D0=98=D0=B7=D0=BC=D0=B5=D0=BD=D0=B8=D0=BB(?= =?UTF-8?q?=D0=B0)=20=D0=BD=D0=B0=20'MyFirstUniverse/src/com/company/cosmi?= =?UTF-8?q?cbody/Planet.java'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/com/company/cosmicbody/Planet.java | 206 +++++++++--------- 1 file changed, 103 insertions(+), 103 deletions(-) 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; +// } + +}