delete
This commit is contained in:
parent
a000e6af0b
commit
9da2ecda59
@ -1,11 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
@ -1,5 +0,0 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main(){
|
||||
printf("Hello world");
|
||||
}
|
||||
@ -1,65 +0,0 @@
|
||||
package com.company;
|
||||
|
||||
import com.company.cosmicbody.Planet;
|
||||
import com.company.cosmicbody.SolarSystem;
|
||||
import com.company.cosmicbody.Star;
|
||||
import com.company.universe.Galaxy;
|
||||
import com.company.universe.PlanetaryNebula;
|
||||
import com.company.universe.Universe;
|
||||
|
||||
public class Main {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Universe myuniverse = new Universe();
|
||||
|
||||
System.out.println("\n");
|
||||
|
||||
PlanetaryNebula orion = new PlanetaryNebula("Orion",5, 18000,200,200,200);
|
||||
PlanetaryNebula buba = new PlanetaryNebula("Buba", 8, 2300, 12,59,94);
|
||||
PlanetaryNebula phonk = new PlanetaryNebula("Phonk", 20, 100000, 0,0,0);
|
||||
|
||||
System.out.println("\n");
|
||||
|
||||
Planet Mercury = new Planet("Mercury", 1333, 6083, 0);
|
||||
Planet Venus = new Planet("Venus", 4867, 938, 12.1);
|
||||
Planet Earth = new Planet("Earth", 100000, 108321);
|
||||
Planet Mars = new Planet("Mars", 641, 16318, 9.81);
|
||||
Planet Jupiter = new Planet("Jupiter", 3, 71313, 20.89);
|
||||
Planet Saturn = new Planet("Saturn", 1000, 108408, 95.8);
|
||||
Planet Uranus = new Planet("Uranus", 1000, 202156, 255.55);
|
||||
Planet Neptune = new Planet("Neptune", 7050, 620654, 0);
|
||||
|
||||
System.out.println("\n");
|
||||
Star sun = new Star("Sun", 1.392, 1.40927, 1499726.85);
|
||||
sun.on();
|
||||
|
||||
System.out.println("\n");
|
||||
|
||||
SolarSystem solarSystem = new SolarSystem();
|
||||
solarSystem.addBody(Mercury);
|
||||
solarSystem.addBody(Venus);
|
||||
solarSystem.addBody(Earth);
|
||||
solarSystem.addBody(Mars);
|
||||
solarSystem.addBody(Jupiter);
|
||||
solarSystem.addBody(Saturn);
|
||||
solarSystem.addBody(Uranus);
|
||||
solarSystem.addBody(Neptune);
|
||||
|
||||
System.out.println("\n");
|
||||
|
||||
Galaxy milkyWay = new Galaxy("Milky Way");
|
||||
milkyWay.addSustava(solarSystem);
|
||||
|
||||
Galaxy Hryshchenko = new Galaxy("Hryshchenko");
|
||||
Hryshchenko.addSustava(solarSystem);
|
||||
|
||||
System.out.println("\n");
|
||||
|
||||
milkyWay.sendMessage(Hryshchenko, "Hi, I'm you friend");
|
||||
Hryshchenko.sendMessage(milkyWay, "Hi.");
|
||||
|
||||
System.out.println("\n");
|
||||
|
||||
myuniverse.stopUniverse();
|
||||
}
|
||||
}
|
||||
@ -1,13 +0,0 @@
|
||||
package com.company.cosmicbody;
|
||||
|
||||
public class CosmicBody {
|
||||
private String body;
|
||||
|
||||
public String getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
protected void setBody(String body) {
|
||||
this.body = body;
|
||||
}
|
||||
}
|
||||
@ -1,106 +0,0 @@
|
||||
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;
|
||||
}
|
||||
|
||||
public 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.");
|
||||
}
|
||||
if(Math.abs(this.weight-weight) > 1000){
|
||||
decreaseGravity(0.1);
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public double getDiameter() {
|
||||
return diameter;
|
||||
}
|
||||
|
||||
public void setDiameter(double diameter) {
|
||||
this.diameter = diameter;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public 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;
|
||||
System.out.println("Planet is: " + name + " has been created. Parameters: " + weight + " " + diameter + ". Gravitation: " + gravitation);
|
||||
}
|
||||
|
||||
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;
|
||||
System.out.println("Planet is: " + name + " has been created. Parameters: " + weight + " " + diameter + ". Gravitation: " + gravitation);
|
||||
}
|
||||
|
||||
public Planet() {
|
||||
this.name = "Earth";
|
||||
this.weight = 5972200;
|
||||
this.diameter = 12756;
|
||||
System.out.println("Planet is: " + name + " has been created. Parameters: " + weight + " " + diameter + ". Gravitation: " + gravitation);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,40 +0,0 @@
|
||||
package com.company.cosmicbody;
|
||||
|
||||
public class SolarSystem {
|
||||
// private Star Sun = new Star();
|
||||
|
||||
// private Planet Earth;
|
||||
// private Planet Mars;
|
||||
// private Planet Jupiter;
|
||||
// private Planet Saturn;
|
||||
|
||||
private CosmicBody[] orbitalBody = new CosmicBody[500000000];
|
||||
private int objectCounter;
|
||||
|
||||
public SolarSystem() {
|
||||
//star = new Star();
|
||||
|
||||
setObjectCounter(0);
|
||||
orbitalBody[objectCounter] = new Planet("Mars", 432432, 432432);
|
||||
objectCounter++;
|
||||
|
||||
orbitalBody[objectCounter] = new Planet("Venusa", 55, 32342);
|
||||
objectCounter++;
|
||||
|
||||
orbitalBody[objectCounter] = new Star("Polar",0,0,0);
|
||||
objectCounter++;
|
||||
}
|
||||
|
||||
public void addBody(CosmicBody newBody){
|
||||
orbitalBody[objectCounter] = newBody;
|
||||
objectCounter++;
|
||||
}
|
||||
|
||||
public int getObjectCounter() {
|
||||
return objectCounter;
|
||||
}
|
||||
|
||||
public void setObjectCounter(int objectCounter) {
|
||||
this.objectCounter = objectCounter;
|
||||
}
|
||||
}
|
||||
@ -1,68 +0,0 @@
|
||||
package com.company.cosmicbody;
|
||||
|
||||
public class Star extends CosmicBody {
|
||||
private String name;
|
||||
private double weight;
|
||||
private double radius;
|
||||
private double temperature;
|
||||
private Boolean light = false;
|
||||
|
||||
public Star(String name, double weight, double radius, double temperature) {
|
||||
this.name = name;
|
||||
this.weight = weight;
|
||||
this.radius = radius;
|
||||
this.temperature = temperature;
|
||||
System.out.println("Star is: " + name + " has been created. Parameters: " + weight + ", " + radius + ", " + temperature);
|
||||
}
|
||||
|
||||
public Star(){
|
||||
this.name = "naname";
|
||||
this.weight = 1000^35;
|
||||
this.temperature = 500000;
|
||||
System.out.println("Star is: " + name + " has been created");
|
||||
}
|
||||
|
||||
public void on(){
|
||||
this.light = true;
|
||||
this.temperature = temperature + 10000;
|
||||
System.out.println("Status: on" + ". Temperature = " + temperature);
|
||||
}
|
||||
|
||||
public void off(){
|
||||
this.light = false;
|
||||
this.temperature = temperature - 10000;
|
||||
System.out.println("Status: off" + ". Temperature = " + temperature);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public double getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(double weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public double getRadius() {
|
||||
return radius;
|
||||
}
|
||||
|
||||
public void setRadius(double radius) {
|
||||
this.radius = radius;
|
||||
}
|
||||
|
||||
public double getTemperature() {
|
||||
return temperature;
|
||||
}
|
||||
|
||||
public void setTemperature(double temperature) {
|
||||
this.temperature = temperature;
|
||||
}
|
||||
}
|
||||
@ -1,21 +0,0 @@
|
||||
package com.company.cosmicbody;
|
||||
|
||||
public class Сomet extends CosmicBody {
|
||||
private int object_counter;
|
||||
|
||||
private CosmicBody[] orbitalBody = new CosmicBody[500000000];
|
||||
|
||||
public Сomet() {
|
||||
setObject_counter(0);
|
||||
orbitalBody[object_counter] = new Сomet();
|
||||
object_counter++;
|
||||
}
|
||||
|
||||
public int getObject_counter() {
|
||||
return object_counter;
|
||||
}
|
||||
|
||||
public void setObject_counter(int object_counter) {
|
||||
this.object_counter = object_counter;
|
||||
}
|
||||
}
|
||||
@ -1,46 +0,0 @@
|
||||
package com.company.universe;
|
||||
|
||||
import com.company.cosmicbody.SolarSystem;
|
||||
|
||||
public class Galaxy {
|
||||
|
||||
private String name;
|
||||
private SolarSystem[] systems = new SolarSystem[5000];
|
||||
private int objectCounter;
|
||||
|
||||
private String message;
|
||||
|
||||
public void sendMessage(Galaxy galaxy, String message){
|
||||
galaxy.setMessage(message);
|
||||
System.out.println("Meassage: '" + message + "' from " + this.name + " has been send to: " + galaxy.name);
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public Galaxy(String name) {
|
||||
this.name = name;
|
||||
this.objectCounter = 0;
|
||||
System.out.println("Galaxy is: " + name + " has been created.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void addSustava(SolarSystem system){
|
||||
this.systems[objectCounter] = system;
|
||||
this.setObjectCounter(this.objectCounter++);
|
||||
}
|
||||
|
||||
public int getObjectCounter() {
|
||||
return objectCounter;
|
||||
}
|
||||
|
||||
private void setObjectCounter(int objectCounter) {
|
||||
this.objectCounter = objectCounter;
|
||||
}
|
||||
}
|
||||
@ -1,28 +0,0 @@
|
||||
package com.company.universe;
|
||||
|
||||
public class PlanetaryNebula {
|
||||
|
||||
private String name;
|
||||
private long size;
|
||||
private long lifeDuration;
|
||||
private long x, y , z;
|
||||
|
||||
public PlanetaryNebula(){
|
||||
name = "myName";
|
||||
size = 0;
|
||||
lifeDuration = 0;
|
||||
x = 0; y = 0; z=0;
|
||||
System.out.println("Created Planetary Nebula: " + name + "Parameters: " + lifeDuration + ", " + size + ". Coordination: " + x + ", " + y + ", " + z);
|
||||
}
|
||||
|
||||
public PlanetaryNebula(String name,long lifeDuration, long size, long x, long y, long z) {
|
||||
this.name = name;
|
||||
this.lifeDuration = lifeDuration;
|
||||
this.size = size;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
System.out.println("Created Planetary Nebula: " + name + "Parameters: " + lifeDuration + ", " + size + ". Coordination: " + x + ", " + y + ", " + z);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,40 +0,0 @@
|
||||
package com.company.universe;
|
||||
|
||||
public class Universe {
|
||||
private boolean state;
|
||||
private long size;
|
||||
|
||||
public Universe() {
|
||||
state = false;
|
||||
size = 0;
|
||||
startUniverse();
|
||||
}
|
||||
|
||||
public void startUniverse(){
|
||||
state = true;
|
||||
System.out.println("World is ready");
|
||||
increaseSize();
|
||||
decreaseSize(10000);
|
||||
}
|
||||
|
||||
public void stopUniverse(){
|
||||
state = false;
|
||||
System.out.println("World is stop");
|
||||
}
|
||||
|
||||
private void increaseSize(){
|
||||
while (size<999000){
|
||||
size++;
|
||||
//System.out.println("Wait. Universe " + size + "km3");
|
||||
}
|
||||
System.out.println("Universe is " + size + "km3");
|
||||
}
|
||||
|
||||
private void decreaseSize(long desiredSize){
|
||||
while (size > desiredSize){
|
||||
size--;
|
||||
//System.out.println ("Wait. Compressed world " + size + "km3");
|
||||
}
|
||||
System.out.println ("Compress world is " + size + "km3");
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user