Init commit

This commit is contained in:
ChronosX88 2019-09-21 17:07:09 +04:00
commit 244099760e
27 changed files with 1204 additions and 0 deletions

View File

@ -0,0 +1 @@
<html>Simple <b>Java</b> application that includes a class with <code>main()</code> method</html>

View 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_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/Fraction.iml" filepath="$PROJECT_DIR$/Fraction.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,3 @@
<template>
<input-field default="com.company">IJ_BASE_PACKAGE</input-field>
</template>

View File

@ -0,0 +1,219 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="fb6b3fcb-2442-4652-82cb-0ab03142d32b" name="Default Changelist" comment="" />
<ignored path="$PROJECT_DIR$/out/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<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="FUSProjectUsageTrigger">
<session id="1584675596">
<usages-collector id="statistics.lifecycle.project">
<counts>
<entry key="project.closed" value="4" />
<entry key="project.open.time.18" value="1" />
<entry key="project.open.time.21" value="1" />
<entry key="project.open.time.7" value="1" />
<entry key="project.open.time.9" value="1" />
<entry key="project.opened" value="4" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.open">
<counts>
<entry key="java" value="3" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.open">
<counts>
<entry key="JAVA" value="3" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.edit">
<counts>
<entry key="java" value="1583" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.edit">
<counts>
<entry key="JAVA" value="1583" />
</counts>
</usages-collector>
</session>
</component>
<component name="FileEditorManager">
<leaf />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Class" />
</list>
</option>
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/src/main/Fraction.java" />
<option value="$PROJECT_DIR$/src/main/Main.java" />
</list>
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="y" value="28" />
<option name="width" value="1366" />
<option name="height" value="711" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="Scope" />
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="Fraction" type="b2602c69:ProjectViewProjectNode" />
<item name="Fraction" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Fraction" type="b2602c69:ProjectViewProjectNode" />
<item name="Fraction" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="Fraction" type="b2602c69:ProjectViewProjectNode" />
<item name="Fraction" type="462c0819:PsiDirectoryNode" />
<item name="src" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
</path>
</expand>
<select />
</subPane>
</pane>
</panes>
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration name="Main" type="Application" factoryName="Application" temporary="true">
<option name="MAIN_CLASS_NAME" value="main.Main" />
<module name="Fraction" />
<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="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="fb6b3fcb-2442-4652-82cb-0ab03142d32b" name="Default Changelist" comment="" />
<created>1540826171724</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1540826171724</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="-1" y="27" width="1682" height="997" extended-state="6" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.21052632" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Designer" order="2" />
<window_info id="UI Designer" order="3" />
<window_info id="Favorites" order="4" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" weight="0.32933104" />
<window_info anchor="bottom" id="Debug" order="3" sideWeight="0.49924126" weight="0.39965695" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Version Control" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Terminal" order="8" />
<window_info anchor="bottom" id="Event Log" order="9" sideWeight="0.5007587" side_tool="true" weight="0.39965695" />
<window_info anchor="bottom" id="Messages" order="10" weight="0.32933104" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="right" id="Palette" order="3" />
<window_info anchor="right" id="Palette&#9;" order="4" />
<window_info anchor="right" id="Maven Projects" order="5" />
</layout>
<layout-to-restore>
<window_info id="Designer" order="0" />
<window_info id="UI Designer" order="1" />
<window_info id="Favorites" order="2" side_tool="true" />
<window_info active="true" content_ui="combo" id="Project" order="3" visible="true" weight="0.24962063" />
<window_info id="Structure" order="4" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Version Control" order="0" show_stripe_button="false" />
<window_info anchor="bottom" id="Terminal" order="1" />
<window_info anchor="bottom" id="Event Log" order="2" side_tool="true" />
<window_info anchor="bottom" id="Messages" order="3" weight="0.32933104" />
<window_info anchor="bottom" id="Message" order="4" />
<window_info anchor="bottom" id="Find" order="5" />
<window_info anchor="bottom" id="Run" order="6" visible="true" weight="0.32933104" />
<window_info anchor="bottom" id="Debug" order="7" weight="0.4" />
<window_info anchor="bottom" id="Cvs" order="8" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="9" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="10" />
<window_info anchor="right" id="Palette" order="0" />
<window_info anchor="right" id="Palette&#9;" order="1" />
<window_info anchor="right" id="Maven Projects" order="2" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="3" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="4" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="5" weight="0.25" />
</layout-to-restore>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="editorHistoryManager">
<entry file="jar:///usr/lib/jvm/java-8-oracle/src.zip!/java/lang/Object.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="108">
<caret line="234" column="18" selection-start-line="234" selection-start-column="18" selection-end-line="234" selection-end-column="18" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="210">
<caret line="14" column="26" selection-start-line="14" selection-start-column="26" selection-end-line="14" selection-end-column="26" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/Fraction.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="345">
<caret line="25" column="72" selection-start-line="25" selection-start-column="72" selection-end-line="25" selection-end-column="72" />
</state>
</provider>
</entry>
</component>
</project>

12
FractionCalc/Fraction.iml Normal file
View File

@ -0,0 +1,12 @@
<?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>

Binary file not shown.

View File

@ -0,0 +1,61 @@
package main;
public class Fraction {
private int numerator;
private int denominator;
Fraction(int numerator, int denominator) {
this.numerator = numerator;
this.denominator = denominator;
}
public int getNumerator() { return numerator; }
public int getDenominator() {
return denominator;
}
public void add(Fraction fr) {
Fraction result = new Fraction(this.numerator * fr.denominator + fr.numerator * this.denominator, this.denominator * fr.denominator);
this.numerator = result.numerator;
this.denominator = result.denominator;
}
public void subtract(Fraction fr) {
Fraction result = new Fraction(this.numerator * fr.denominator - fr.numerator * this.denominator, this.denominator * fr.denominator);
this.numerator = result.numerator;
this.denominator = result.denominator;
}
public void multiply(Fraction fr) {
Fraction result = new Fraction((this.numerator * fr.denominator) * (fr.numerator * this.denominator), this.denominator * fr.denominator);
this.numerator = result.numerator;
this.denominator = result.denominator;
}
public void divide(Fraction fr) {
Fraction result = new Fraction((this.numerator * fr.numerator) * (fr.denominator * this.denominator), (this.denominator * fr.numerator));
this.numerator = result.numerator;
this.denominator = result.denominator;
}
public void reduce() {
int min = this.numerator > this.denominator ? this.denominator : this.numerator;
int gcd = 0; // GCD - Greatest Common Divisor
for (int i = 1; i < min; i++) {
if(this.numerator % i == 0 && this.denominator % i == 0){
if(i > gcd)
gcd = i;
}
}
this.numerator /= gcd;
this.denominator /= gcd;
}
public String toString() {
String str = new String(this.numerator + "/" + this.denominator);
return str;
}
}

View File

@ -0,0 +1,19 @@
package main;
// Driver for managing the Fraction class
public class Main {
public static void main(String[] args) {
Fraction fraction = new Fraction(2,4);
Fraction fraction1 = new Fraction(4, 6);
fraction.add(fraction1);
fraction.subtract(fraction1);
fraction.multiply(fraction1);
fraction.divide(fraction1);
fraction.reduce();
System.out.println(fraction.toString());
}
}

View File

@ -0,0 +1 @@
<html>Simple <b>Java</b> application that includes a class with <code>main()</code> method</html>

View 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_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/OneForThree.iml" filepath="$PROJECT_DIR$/OneForThree.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,3 @@
<template>
<input-field default="com.company">IJ_BASE_PACKAGE</input-field>
</template>

View File

@ -0,0 +1,222 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="0246f427-43b9-400c-9c8c-dd65a74f38cb" name="Default Changelist" comment="" />
<ignored path="$PROJECT_DIR$/out/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<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="FUSProjectUsageTrigger">
<session id="1482277365">
<usages-collector id="statistics.lifecycle.project">
<counts>
<entry key="project.closed" value="3" />
<entry key="project.open.time.13" value="1" />
<entry key="project.open.time.21" value="1" />
<entry key="project.open.time.7" value="1" />
<entry key="project.opened" value="3" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.edit">
<counts>
<entry key="java" value="238" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.edit">
<counts>
<entry key="JAVA" value="238" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.open">
<counts>
<entry key="class" value="1" />
<entry key="java" value="1" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.open">
<counts>
<entry key="CLASS" value="1" />
<entry key="JAVA" value="1" />
</counts>
</usages-collector>
</session>
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/main/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="27" selection-start-line="27" selection-end-line="27" />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/src/main/Main.java" />
</list>
</option>
</component>
<component name="ProjectFrameBounds" extendedState="6">
<option name="x" value="10" />
<option name="y" value="48" />
<option name="width" value="1346" />
<option name="height" value="672" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="PackagesPane" />
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<expand>
<path>
<item name="OneForThree" type="b2602c69:ProjectViewProjectNode" />
<item name="OneForThree" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="OneForThree" type="b2602c69:ProjectViewProjectNode" />
<item name="OneForThree" type="462c0819:PsiDirectoryNode" />
<item name="out" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="OneForThree" type="b2602c69:ProjectViewProjectNode" />
<item name="OneForThree" type="462c0819:PsiDirectoryNode" />
<item name="out" type="462c0819:PsiDirectoryNode" />
<item name="production" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="OneForThree" type="b2602c69:ProjectViewProjectNode" />
<item name="OneForThree" type="462c0819:PsiDirectoryNode" />
<item name="out" type="462c0819:PsiDirectoryNode" />
<item name="production" type="462c0819:PsiDirectoryNode" />
<item name="OneForThree" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="OneForThree" type="b2602c69:ProjectViewProjectNode" />
<item name="OneForThree" type="462c0819:PsiDirectoryNode" />
<item name="out" type="462c0819:PsiDirectoryNode" />
<item name="production" type="462c0819:PsiDirectoryNode" />
<item name="OneForThree" type="462c0819:PsiDirectoryNode" />
<item name="main" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="OneForThree" type="b2602c69:ProjectViewProjectNode" />
<item name="External Libraries" type="cb654da1:ExternalLibrariesNode" />
</path>
</expand>
<select />
</subPane>
</pane>
</panes>
</component>
<component name="PropertiesComponent">
<property name="settings.editor.selected.configurable" value="editor.preferences.fonts.default" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration name="Main" type="Application" factoryName="Application" temporary="true">
<option name="MAIN_CLASS_NAME" value="main.Main" />
<module name="OneForThree" />
<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="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="0246f427-43b9-400c-9c8c-dd65a74f38cb" name="Default Changelist" comment="" />
<created>1536858948207</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1536858948207</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="-1" y="28" width="1368" height="713" extended-state="6" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.25341427" />
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
<window_info id="Designer" order="2" />
<window_info id="UI Designer" order="3" />
<window_info id="Favorites" order="4" side_tool="true" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" weight="0.9691252" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.39965695" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Version Control" order="7" show_stripe_button="false" />
<window_info anchor="bottom" id="Terminal" order="8" />
<window_info anchor="bottom" id="Event Log" order="9" side_tool="true" />
<window_info anchor="bottom" id="Messages" order="10" />
<window_info anchor="right" id="Commander" internal_type="SLIDING" order="0" type="SLIDING" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="right" id="Palette" order="3" />
<window_info anchor="right" id="Palette&#9;" order="4" />
<window_info anchor="right" id="Maven Projects" order="5" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/out/production/OneForThree/main/Main.class">
<provider selected="true" editor-type-id="text-editor" />
</entry>
<entry file="jar:///usr/lib/jvm/java-8-oracle/src.zip!/java/lang/Math.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="265">
<caret line="440" column="25" selection-start-line="440" selection-start-column="25" selection-end-line="440" selection-end-column="25" />
<folding>
<element signature="e#17181#17182#0" expanded="true" />
<element signature="e#17264#17265#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="240">
<caret line="27" selection-start-line="27" selection-end-line="27" />
</state>
</provider>
</entry>
</component>
</project>

View File

@ -0,0 +1,12 @@
<?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>

View File

@ -0,0 +1,54 @@
package main;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int rangeBegin = 0;
int rangeEnd = 100;
int tempRand = 0;
//int lastRand = 0;
int countOfAttempt = 1;
String userAnswer;
System.out.println("OneFourThree program guesses the number that the user made.");
System.out.println("Make a number from 0 to " + rangeEnd + ".");
System.out.println("Enter +/-/= if the number that the computer displays is more/less than your number, or it is correct.");
System.out.println("For exit, write \"quit\".");
System.out.printf("\n\n");
System.out.print("Make a number, then press Enter...");
scanner.nextLine();
System.out.printf("\n\n");
while (true) {
tempRand = (int) (int)Math.round((rangeBegin + rangeEnd) / 2);
System.out.println(tempRand);
System.out.print("Правильно? +/-/=: ");
userAnswer = scanner.next();
if( userAnswer.equals("+") ) {
rangeBegin = tempRand;
countOfAttempt++;
} else if( userAnswer.equals("-") ) {
rangeEnd = tempRand;
countOfAttempt++;
} else if( userAnswer.equals("=") ) {
System.out.println("Вы выиграли!");
System.out.println("Компьютер угадал ваше число за " + countOfAttempt + " попыток (-ки).");
break;
} else if( userAnswer.equals("quit") ) {
System.out.println("Выходим...");
break;
}
}
}
}

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>

View File

@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="" />
</component>

View File

@ -0,0 +1 @@
<html>Simple <b>Java</b> application that includes a class with <code>main()</code> method</html>

12
StringCalc/.idea/misc.xml Normal file
View 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_1_8" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/UnnamedCalc.iml" filepath="$PROJECT_DIR$/UnnamedCalc.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,3 @@
<template>
<input-field default="com.company">IJ_BASE_PACKAGE</input-field>
</template>

View File

@ -0,0 +1,408 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="1fea5f5f-b642-434d-a463-71cf57001c3e" name="Default" comment="" />
<ignored path="UnnamedCalc.iws" />
<ignored path=".idea/workspace.xml" />
<ignored path="$PROJECT_DIR$/out/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<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="CreatePatchCommitExecutor">
<option name="PATCH_PATH" value="" />
</component>
<component name="FUSProjectUsageTrigger">
<session id="928510969">
<usages-collector id="statistics.lifecycle.project">
<counts>
<entry key="project.closed" value="3" />
<entry key="project.open.time.1" value="1" />
<entry key="project.open.time.7" value="1" />
<entry key="project.open.time.9" value="1" />
<entry key="project.opened" value="3" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.extensions.edit">
<counts>
<entry key="java" value="1415" />
</counts>
</usages-collector>
<usages-collector id="statistics.file.types.edit">
<counts>
<entry key="JAVA" value="1415" />
</counts>
</usages-collector>
</session>
</component>
<component name="FavoritesManager">
<favorites_list name="UnnamedCalc" />
</component>
<component name="FileEditorManager">
<leaf />
</component>
<component name="IdeDocumentHistory">
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/src/main/Main.java" />
</list>
</option>
</component>
<component name="ProjectFrameBounds">
<option name="y" value="28" />
<option name="width" value="1366" />
<option name="height" value="712" />
</component>
<component name="ProjectView">
<navigator proportions="" version="1">
<foldersAlwaysOnTop value="true" />
</navigator>
<panes />
</component>
<component name="PropertiesComponent">
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
</component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager">
<configuration default="true" type="AndroidRunConfigurationType" factoryName="Android Application">
<module name="" />
<option name="DEPLOY" value="true" />
<option name="ARTIFACT_NAME" value="" />
<option name="PM_INSTALL_OPTIONS" value="" />
<option name="ACTIVITY_EXTRA_FLAGS" value="" />
<option name="MODE" value="default_activity" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="PREFERRED_AVD" value="" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="DEBUGGER_TYPE" value="Java" />
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
<option name="PREFERRED_AVD" value="" />
<Java />
<Profilers>
<option name="GAPID_DISABLE_PCS" value="false" />
</Profilers>
<option name="DEEP_LINK" value="" />
<option name="ACTIVITY_CLASS" value="" />
<method>
<option name="Make" enabled="true" />
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration default="true" type="AndroidTestRunConfigurationType" factoryName="Android Tests">
<module name="" />
<option name="TESTING_TYPE" value="0" />
<option name="INSTRUMENTATION_RUNNER_CLASS" value="" />
<option name="METHOD_NAME" value="" />
<option name="CLASS_NAME" value="" />
<option name="PACKAGE_NAME" value="" />
<option name="EXTRA_OPTIONS" value="" />
<option name="TARGET_SELECTION_MODE" value="SHOW_DIALOG" />
<option name="PREFERRED_AVD" value="" />
<option name="CLEAR_LOGCAT" value="false" />
<option name="SHOW_LOGCAT_AUTOMATICALLY" value="true" />
<option name="SKIP_NOOP_APK_INSTALLATIONS" value="true" />
<option name="FORCE_STOP_RUNNING_APP" value="true" />
<option name="DEBUGGER_TYPE" value="Java" />
<option name="USE_LAST_SELECTED_DEVICE" value="false" />
<option name="PREFERRED_AVD" value="" />
<Java />
<Profilers>
<option name="GAPID_DISABLE_PCS" value="false" />
</Profilers>
<method>
<option name="Make" enabled="true" />
<option name="Android.Gradle.BeforeRunTask" enabled="true" />
</method>
</configuration>
<configuration default="true" type="JUnitTestDiscovery" factoryName="JUnit Test Discovery" changeList="All">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="TEST_OBJECT" value="class" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<envs />
<patterns />
<method />
</configuration>
<configuration default="true" type="TestNGTestDiscovery" factoryName="TestNG Test Discovery" changeList="All">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
<module name="" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="SUITE_NAME" />
<option name="PACKAGE_NAME" />
<option name="MAIN_CLASS_NAME" />
<option name="METHOD_NAME" />
<option name="GROUP_NAME" />
<option name="TEST_OBJECT" value="CLASS" />
<option name="VM_PARAMETERS" />
<option name="PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<option name="OUTPUT_DIRECTORY" />
<option name="ANNOTATION_TYPE" />
<option name="ENV_VARIABLES" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="TEST_SEARCH_SCOPE">
<value defaultName="singleModule" />
</option>
<option name="USE_DEFAULT_REPORTERS" value="false" />
<option name="PROPERTIES_FILE" />
<envs />
<properties />
<listeners />
<method />
</configuration>
<configuration name="Main" type="Application" factoryName="Application" temporary="true">
<option name="MAIN_CLASS_NAME" value="main.Main" />
<module name="UnnamedCalc" />
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
<RunnerSettings RunnerId="Run" />
<ConfigurationWrapper RunnerId="Run" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="JUnit" factoryName="JUnit">
<option name="VM_PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="KotlinStandaloneScriptRunConfigurationType" factoryName="Kotlin script">
<option name="filePath" />
<option name="vmParameters" />
<option name="alternativeJrePath" />
<option name="programParameters" />
<option name="passParentEnvs" value="true" />
<option name="workingDirectory" />
<option name="isAlternativeJrePathEnabled" value="false" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="MAIN_CLASS_NAME" />
<option name="WORKING_DIRECTORY" />
<module name="" />
<option name="filePath" />
<option name="vmParameters" />
<option name="alternativeJrePath" />
<option name="programParameters" />
<option name="passParentEnvs" value="true" />
<option name="workingDirectory" />
<option name="isAlternativeJrePathEnabled" value="false" />
<option name="VM_PARAMETERS" />
<option name="PROGRAM_PARAMETERS" />
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
<option name="ALTERNATIVE_JRE_PATH" />
<option name="PASS_PARENT_ENVS" value="true" />
<option name="MAIN_CLASS_NAME" />
<option name="WORKING_DIRECTORY" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration default="true" type="TestNG" factoryName="TestNG">
<option name="VM_PARAMETERS" />
<option name="WORKING_DIRECTORY" />
<properties />
<listeners />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<recent_temporary>
<list>
<item itemvalue="Application.Main" />
</list>
</recent_temporary>
</component>
<component name="SvnConfiguration">
<configuration />
</component>
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="1fea5f5f-b642-434d-a463-71cf57001c3e" name="Default" comment="" />
<created>1537276489642</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1537276489642</updated>
</task>
<servers />
</component>
<component name="ToolWindowManager">
<frame x="0" y="28" width="1366" height="712" extended-state="0" />
<layout>
<window_info content_ui="combo" id="Project" order="0" sideWeight="0.488" weight="0.25" />
<window_info id="Structure" order="1" weight="0.25" />
<window_info id="Capture Tool" order="2" />
<window_info id="UI Designer" order="3" />
<window_info id="Palette&#9;" order="4" />
<window_info id="Favorites" order="5" sideWeight="0.512" side_tool="true" weight="0.25" />
<window_info anchor="bottom" id="Message" order="0" />
<window_info anchor="bottom" id="Find" order="1" />
<window_info anchor="bottom" id="Run" order="2" weight="0.3281787" />
<window_info anchor="bottom" id="Debug" order="3" weight="0.39862543" />
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
<window_info anchor="bottom" id="TODO" order="6" />
<window_info anchor="bottom" id="Terminal" order="7" />
<window_info anchor="bottom" id="Event Log" order="8" side_tool="true" />
<window_info anchor="bottom" id="Version Control" order="9" show_stripe_button="false" />
<window_info anchor="bottom" id="Messages" order="10" weight="0.3281787" />
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
<window_info anchor="right" id="Palette" order="3" />
<window_info anchor="right" id="Capture Analysis" order="4" />
<window_info anchor="right" id="Designer" order="5" />
<window_info anchor="right" id="Maven Projects" order="6" />
</layout>
</component>
<component name="Vcs.Log.UiProperties">
<option name="RECENTLY_FILTERED_USER_GROUPS">
<collection />
</option>
<option name="RECENTLY_FILTERED_BRANCH_GROUPS">
<collection />
</option>
</component>
<component name="VcsContentAnnotationSettings">
<option name="myLimit" value="2678400000" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/Main.java</url>
<line>25</line>
<properties />
<option name="timeStamp" value="38" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/Main.java</url>
<line>33</line>
<properties />
<option name="timeStamp" value="39" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/Main.java</url>
<line>80</line>
<properties />
<option name="timeStamp" value="40" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/Main.java</url>
<line>53</line>
<properties />
<option name="timeStamp" value="42" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/Main.java</url>
<line>54</line>
<properties />
<option name="timeStamp" value="43" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/Main.java</url>
<line>55</line>
<properties />
<option name="timeStamp" value="44" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/Main.java</url>
<line>57</line>
<properties />
<option name="timeStamp" value="45" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/Main.java</url>
<line>58</line>
<properties />
<option name="timeStamp" value="46" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/Main.java</url>
<line>59</line>
<properties />
<option name="timeStamp" value="49" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/Main.java</url>
<line>63</line>
<properties />
<option name="timeStamp" value="51" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/Main.java</url>
<line>67</line>
<properties />
<option name="timeStamp" value="53" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/Main.java</url>
<line>71</line>
<properties />
<option name="timeStamp" value="56" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/main/Main.java</url>
<line>76</line>
<properties />
<option name="timeStamp" value="58" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
</component>
<component name="antWorkspaceConfiguration">
<option name="IS_AUTOSCROLL_TO_SOURCE" value="false" />
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
<entry file="jar:///usr/lib/jvm/java-8-oracle/src.zip!/java/lang/String.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1386">
<caret line="110" column="19" selection-start-line="110" selection-start-column="19" selection-end-line="110" selection-end-column="19" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/main/Main.java">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="286">
<caret line="77" column="26" selection-start-line="77" selection-start-column="26" selection-end-line="77" selection-end-column="26" />
<folding>
<element signature="imports" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component>
</project>

View File

@ -0,0 +1,12 @@
<?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>

Binary file not shown.

View File

@ -0,0 +1,88 @@
package main;
import java.util.Scanner;
import java.util.Stack;
import java.util.stream.IntStream;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String line;
Stack<String> operators = new Stack<>();
Stack<Float> numbers = new Stack<>();
line = scanner.nextLine();
char[] lineArray = new char[line.length()];
lineArray = line.toCharArray();
System.out.println(calcExpression(lineArray, operators, numbers));
}
static float calcExpression(char[] charArr, Stack<String> operators, Stack<Float> numbers) {
for(int i = 0; i < charArr.length; i++) {
String operatorTemp;
float numberTemp;
if (charArr == null)
throw new IllegalArgumentException("Num не должен быть null");
switch(charArr[i]) {
case '(': {
break;
}
case '+': {
operators.push("+");
break;
}
case '-': {
operators.push("-");
break;
}
case '*': {
operators.push("*");
break;
}
case '/': {
operators.push("/");
break;
}
case ')': {
operatorTemp = operators.pop();
numberTemp = numbers.pop();
switch(operatorTemp) {
case "+": {
numberTemp = numbers.pop() + numberTemp;
break;
}
case "-": {
numberTemp = numbers.pop() - numberTemp;
break;
}
case "*": {
numberTemp = numbers.pop() * numberTemp;
break;
}
case "/": {
numberTemp = numbers.pop() / numberTemp;
break;
}
}
numbers.push(numberTemp);
break;
}
default: {
numbers.push(Float.parseFloat(String.valueOf(charArr[i])));
}
}
}
return numbers.pop();
}
}