Universe
This commit is contained in:
parent
3ac05019a8
commit
943b5fe09b
1
MyFirstUniverse/.idea/description.html
Normal file
1
MyFirstUniverse/.idea/description.html
Normal file
@ -0,0 +1 @@
|
||||
<html>Simple <b>Java</b> application that includes a class with <code>main()</code> method</html>
|
||||
7
MyFirstUniverse/.idea/discord.xml
Normal file
7
MyFirstUniverse/.idea/discord.xml
Normal file
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DiscordProjectSettings">
|
||||
<option name="show" value="ASK" />
|
||||
<option name="description" value="" />
|
||||
</component>
|
||||
</project>
|
||||
6
MyFirstUniverse/.idea/encodings.xml
Normal file
6
MyFirstUniverse/.idea/encodings.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="PROJECT" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
||||
12
MyFirstUniverse/.idea/misc.xml
Normal file
12
MyFirstUniverse/.idea/misc.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="ProjectKey">
|
||||
<option name="state" value="project://e2804f05-5315-4fc6-a121-c522a6c26470" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_19" default="true" project-jdk-name="19" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
MyFirstUniverse/.idea/modules.xml
Normal file
8
MyFirstUniverse/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/MyFirstUniverse.iml" filepath="$PROJECT_DIR$/MyFirstUniverse.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
3
MyFirstUniverse/.idea/project-template.xml
Normal file
3
MyFirstUniverse/.idea/project-template.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<template>
|
||||
<input-field default="com.company">IJ_BASE_PACKAGE</input-field>
|
||||
</template>
|
||||
124
MyFirstUniverse/.idea/uiDesigner.xml
Normal file
124
MyFirstUniverse/.idea/uiDesigner.xml
Normal file
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
||||
6
MyFirstUniverse/.idea/vcs.xml
Normal file
6
MyFirstUniverse/.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GitSharedSettings">
|
||||
<option name="synchronizeBranchProtectionRules" value="false" />
|
||||
</component>
|
||||
</project>
|
||||
166
MyFirstUniverse/.idea/workspace.xml
Normal file
166
MyFirstUniverse/.idea/workspace.xml
Normal file
@ -0,0 +1,166 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="857763f3-a81c-449a-8888-ff5df6dee023" name="Changes" comment="" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
<option name="RECENT_TEMPLATES">
|
||||
<list>
|
||||
<option value="Class" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="ADD_SUFFIX_TO_CHERRY_PICKS_OF_PUBLISHED_COMMITS" value="false" />
|
||||
<option name="PREVIEW_PUSH_ON_COMMIT_AND_PUSH" value="false" />
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/svet" />
|
||||
<option name="WARN_ABOUT_CRLF" value="false" />
|
||||
<option name="WARN_ABOUT_DETACHED_HEAD" value="false" />
|
||||
</component>
|
||||
<component name="MarkdownSettingsMigration">
|
||||
<option name="stateVersion" value="1" />
|
||||
</component>
|
||||
<component name="ProjectId" id="2FMghcaH7Xgm9xQ0FjmXbPkGzmg" />
|
||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
||||
<component name="ProjectView">
|
||||
<navigator currentView="ProjectPane" proportions="" version="1" splitterProportion="0.5">
|
||||
<flattenPackages />
|
||||
<showMembers />
|
||||
<showModules />
|
||||
<showLibraryContents />
|
||||
<hideEmptyPackages />
|
||||
<abbreviatePackageNames />
|
||||
<autoscrollToSource />
|
||||
<autoscrollFromSource />
|
||||
<sortByType />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scope" />
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="untitled104" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="untitled104" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="untitled104" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
<PATH>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="untitled104" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="untitled104" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="src" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
<PATH_ELEMENT>
|
||||
<option name="myItemId" value="company" />
|
||||
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
|
||||
</PATH_ELEMENT>
|
||||
</PATH>
|
||||
</subPane>
|
||||
</pane>
|
||||
</panes>
|
||||
</component>
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"WebServerToolWindowFactoryState": "false",
|
||||
"last_opened_file_path": "D:/Study/3year/OOP/MyFirstUniverse",
|
||||
"settings.editor.selected.configurable": "project.propVCSSupport.DirectoryMappings"
|
||||
}
|
||||
}</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="Main" type="Application" factoryName="Application" temporary="true">
|
||||
<option name="MAIN_CLASS_NAME" value="com.company.Main" />
|
||||
<module name="MyFirstUniverse" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
<recent_temporary>
|
||||
<list>
|
||||
<item itemvalue="Application.Main" />
|
||||
</list>
|
||||
</recent_temporary>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="Default task">
|
||||
<changelist id="857763f3-a81c-449a-8888-ff5df6dee023" name="Changes" comment="" />
|
||||
<created>1664307490741</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1664307490741</updated>
|
||||
<workItem from="1664307493533" duration="462000" />
|
||||
<workItem from="1664954212249" duration="490000" />
|
||||
<workItem from="1664955256543" duration="2938000" />
|
||||
<workItem from="1664992953981" duration="2047000" />
|
||||
<workItem from="1665396660524" duration="122000" />
|
||||
<workItem from="1665529647566" duration="30000" />
|
||||
<workItem from="1665559082986" duration="7912000" />
|
||||
<workItem from="1665672593323" duration="70000" />
|
||||
<workItem from="1666768705578" duration="4327000" />
|
||||
<workItem from="1667733329462" duration="202000" />
|
||||
<workItem from="1667742775449" duration="23000" />
|
||||
<workItem from="1667751363182" duration="73000" />
|
||||
<workItem from="1667751705366" duration="13759000" />
|
||||
<workItem from="1667811885207" duration="7287000" />
|
||||
<workItem from="1667824597894" duration="1941000" />
|
||||
<workItem from="1667839107061" duration="895000" />
|
||||
<workItem from="1667840376602" duration="3374000" />
|
||||
<workItem from="1667858084425" duration="124000" />
|
||||
<workItem from="1667858262314" duration="589000" />
|
||||
<workItem from="1667858861369" duration="746000" />
|
||||
<workItem from="1667900810467" duration="5122000" />
|
||||
<workItem from="1667909850990" duration="333000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
<option name="TAB_STATES">
|
||||
<map>
|
||||
<entry key="MAIN">
|
||||
<value>
|
||||
<State />
|
||||
</value>
|
||||
</entry>
|
||||
</map>
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<ignored-roots>
|
||||
<path value="$PROJECT_DIR$/svet" />
|
||||
</ignored-roots>
|
||||
</component>
|
||||
</project>
|
||||
11
MyFirstUniverse/MyFirstUniverse.iml
Normal file
11
MyFirstUniverse/MyFirstUniverse.iml
Normal file
@ -0,0 +1,11 @@
|
||||
<?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>
|
||||
65
MyFirstUniverse/src/com/company/Main.java
Normal file
65
MyFirstUniverse/src/com/company/Main.java
Normal file
@ -0,0 +1,65 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
13
MyFirstUniverse/src/com/company/cosmicbody/CosmicBody.java
Normal file
13
MyFirstUniverse/src/com/company/cosmicbody/CosmicBody.java
Normal file
@ -0,0 +1,13 @@
|
||||
package com.company.cosmicbody;
|
||||
|
||||
public class CosmicBody {
|
||||
private String body;
|
||||
|
||||
public String getBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
protected void setBody(String body) {
|
||||
this.body = body;
|
||||
}
|
||||
}
|
||||
106
MyFirstUniverse/src/com/company/cosmicbody/Planet.java
Normal file
106
MyFirstUniverse/src/com/company/cosmicbody/Planet.java
Normal file
@ -0,0 +1,106 @@
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
40
MyFirstUniverse/src/com/company/cosmicbody/SolarSystem.java
Normal file
40
MyFirstUniverse/src/com/company/cosmicbody/SolarSystem.java
Normal file
@ -0,0 +1,40 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
68
MyFirstUniverse/src/com/company/cosmicbody/Star.java
Normal file
68
MyFirstUniverse/src/com/company/cosmicbody/Star.java
Normal file
@ -0,0 +1,68 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
21
MyFirstUniverse/src/com/company/cosmicbody/Сomet.java
Normal file
21
MyFirstUniverse/src/com/company/cosmicbody/Сomet.java
Normal file
@ -0,0 +1,21 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
46
MyFirstUniverse/src/com/company/universe/Galaxy.java
Normal file
46
MyFirstUniverse/src/com/company/universe/Galaxy.java
Normal file
@ -0,0 +1,46 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
40
MyFirstUniverse/src/com/company/universe/Universe.java
Normal file
40
MyFirstUniverse/src/com/company/universe/Universe.java
Normal file
@ -0,0 +1,40 @@
|
||||
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