From 84440f8e419e7a9bafd55f24419e90e48ec18c34 Mon Sep 17 00:00:00 2001 From: Andriy Protsenko Date: Fri, 9 Oct 2015 15:28:17 +0300 Subject: [PATCH 1/5] The first hometask from geekhub --- .idea/compiler.xml | 22 + .idea/copyright/profiles_settings.xml | 3 + .idea/description.html | 1 + .idea/encodings.xml | 6 + .idea/misc.xml | 50 ++ .idea/modules.xml | 8 + .idea/project-template.xml | 3 + .idea/vcs.xml | 6 + .idea/workspace.xml | 489 ++++++++++++++++++ lesson0.iml | 12 + out/production/lesson0/com/company/Main.class | Bin 0 -> 1515 bytes src/com/company/Main.java | 37 ++ 12 files changed, 637 insertions(+) create mode 100644 .idea/compiler.xml create mode 100644 .idea/copyright/profiles_settings.xml create mode 100644 .idea/description.html create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/project-template.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 lesson0.iml create mode 100644 out/production/lesson0/com/company/Main.class create mode 100644 src/com/company/Main.java diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..96cc43e --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/copyright/profiles_settings.xml b/.idea/copyright/profiles_settings.xml new file mode 100644 index 0000000..e7bedf3 --- /dev/null +++ b/.idea/copyright/profiles_settings.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/.idea/description.html b/.idea/description.html new file mode 100644 index 0000000..db5f129 --- /dev/null +++ b/.idea/description.html @@ -0,0 +1 @@ +Simple Java application that includes a class with main() method \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..0f17a8a --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..ee12254 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..b307b96 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/project-template.xml b/.idea/project-template.xml new file mode 100644 index 0000000..1f08b88 --- /dev/null +++ b/.idea/project-template.xml @@ -0,0 +1,3 @@ + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..0891dbe --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,489 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + 1444389554711 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lesson0.iml b/lesson0.iml new file mode 100644 index 0000000..d5c0743 --- /dev/null +++ b/lesson0.iml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/out/production/lesson0/com/company/Main.class b/out/production/lesson0/com/company/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..13f096a5e1ac4a155c4e51e6365ad4150791d7b7 GIT binary patch literal 1515 zcmaJ>U31$+6g}%NtraD4O&$;KW{Kr4PKL+q7JROU;n8!PK zSHpWc(zqybNv(A?t*Gg;j`#6_h7TpKNL-cpNaC8rs>H_1s zPJfh6_uNjHppsY+!wYDML7d|4=3Qsksdb%TyJkfLKiDQvrbj@5QuP_$xFlz=&C97B zml=`-!^rQ}EY}GFZ@>(?6%Gfkx9Y1x^NRmDg=63pp4afDflb^Hm_3etW$1U?-ax=u z{jb!@O2xoU*lN0E;5NR}@U?+&@U1}M_%|U`YdnPW2xC|{&pv#bDdohn6|@VCEDwIm8j!Y616G#pY#`DiVBJCWBT#c)W+Od_x!)~>TX5u4;WJxZK&`h72G z3!JTd8PRD8@28O^A=Gujq9t=FGDQ@v)}VqdF|7 z5%h=1; i--){ + f = f * i; + } + System.out.println("Factorial = " + f); + } + public static void fibonacci(int number){ + + } + + public static void echoNumber(int number){ + String[] numbers = {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"}; + System.out.println("You type the number "+ numbers[number]); + } + + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + + int a; + + System.out.println("Type number"); + + a = sc.nextInt();//Считываем число + + echoNumber(a); + } +} From d61f91efb342b06d80f072f4e9b629d128bf1604 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D1=96=D0=B9=20=D0=9F=D1=80=D0=BE?= =?UTF-8?q?=D1=86=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Sat, 10 Oct 2015 10:12:35 +0300 Subject: [PATCH 2/5] Create main.java --- main.java | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 main.java diff --git a/main.java b/main.java new file mode 100644 index 0000000..2cc2093 --- /dev/null +++ b/main.java @@ -0,0 +1,37 @@ +package com.company; + +import java.util.Scanner; + +public class Main { + + public static void factorial(int a){ + int f = 0; + + f = a; + + for(int i = a-1; i>=1; i--){ + f = f * i; + } + System.out.println("Factorial = " + f); + } + public static void fibonacci(int number){ + + } + + public static void echoNumber(int number){ + String[] numbers = {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"}; + System.out.println("You type the number "+ numbers[number]); + } + + public static void main(String[] args) { + Scanner sc = new Scanner(System.in); + + int a; + + System.out.println("Type number"); + + a = sc.nextInt();//Считываем число + + echoNumber(a); + } +} From e5a79646a1d2b8fc3386480db8024dd35cc739eb Mon Sep 17 00:00:00 2001 From: Andriy Protsenko Date: Sat, 10 Oct 2015 11:55:37 +0300 Subject: [PATCH 3/5] 2179 bytes src/com/company/Main.java | 53 ++++++++++++++---- 3 files changed, 60 insertions(+), 22 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 0891dbe..bd90e2d 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,7 +1,10 @@ - + + + + @@ -26,8 +29,8 @@ - - + + @@ -88,6 +91,7 @@ + @@ -126,7 +130,6 @@ - @@ -405,12 +408,13 @@ - @@ -418,7 +422,7 @@ - + @@ -470,17 +474,18 @@ - + - - + + + - - + + diff --git a/out/production/lesson0/com/company/Main.class b/out/production/lesson0/com/company/Main.class index 13f096a5e1ac4a155c4e51e6365ad4150791d7b7..925256540fc7ec13f3fa265ee9e4b94412022d54 100644 GIT binary patch literal 2179 zcmaJ>O>@&$6g|(DEZI>YD1@Zg0YfQ-fN@D^_=poAloXeIK;;Gu{Xn*rSizQzBL~>? zN7_whx+{x>Dbp^xYxkY$59z8iZF-*U5C@o!NB2G5ckg}Y+;ipM|NZF~02lByffKl{ zVJ40n_%wkCZpz)Pj?WUfg}n59uHkk9aa`9iC)ast7Nl9!aYu&T)$oN5OGiP+mpYbo z+|zMiM^VQE9S?PUrQ>TI-{|-@fe-OW8e5u@jC15w~-2HZ7(79KWyJpv%Qt96*OIMg_kIGViPzt@}AR>z1>`4a>DXk z&9XD=O5$GSEpPmhz{+taj%@nUI}8GBsT^R>XKbG)Ru18w15Kb!X&t$^A)cAeS}jlB0j${zJw zEV!F^hvTxF*dKPA^}5^~wT29;$qPG$y9Aw-RW;9f7UVr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--git a/src/com/company/Main.java b/src/com/company/Main.java index 2cc2093..caac668 100644 --- a/src/com/company/Main.java +++ b/src/com/company/Main.java @@ -4,34 +4,67 @@ public class Main { - public static void factorial(int a){ - int f = 0; - f = a; + + //get factorial of the number + public static void factorial(){ + Scanner sc = new Scanner(System.in); + int f = 0, a; + + System.out.println("Type number"); + + f = a = sc.nextInt(); for(int i = a-1; i>=1; i--){ f = f * i; } System.out.println("Factorial = " + f); } - public static void fibonacci(int number){ + //sequence of fibonacci + public static void fibonacci(){ + Scanner sc = new Scanner(System.in); + int a = 1; + int b = 1; + int c, number; + System.out.println("Type number"); + number = sc.nextInt(); + System.out.print(a + " "+b+" "); + for(int i = 0; i < number; i++){ + c = a + b; + a = b; + b = c; + System.out.print(c + " "); + } } - - public static void echoNumber(int number){ + //echo verbal value of the number + public static void echoNumber(){ + Scanner sc = new Scanner(System.in); + int number; + System.out.println("Type number"); + number = sc.nextInt(); String[] numbers = {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"}; System.out.println("You type the number "+ numbers[number]); } - public static void main(String[] args) { + public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a; - System.out.println("Type number"); + System.out.println("Choose the program:"); + System.out.println("1-Factorial\n2-Fibonacci\n3-Word value of the number"); + a = sc.nextInt(); + switch (a){ + case 1:factorial(); + break; + case 2:fibonacci(); + break; + case 3:echoNumber(); + break; + default:System.out.println("Select from 1 to 3"); - a = sc.nextInt();//Считываем число + } - echoNumber(a); } } From 7ae371e50815e26c4978bd045333b0ab30e1ceb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D1=96=D0=B9=20=D0=9F=D1=80=D0=BE?= =?UTF-8?q?=D1=86=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Sat, 10 Oct 2015 12:02:37 +0300 Subject: [PATCH 4/5] Update main.java --- main.java | 53 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/main.java b/main.java index 2cc2093..caac668 100644 --- a/main.java +++ b/main.java @@ -4,34 +4,67 @@ public class Main { - public static void factorial(int a){ - int f = 0; - f = a; + + //get factorial of the number + public static void factorial(){ + Scanner sc = new Scanner(System.in); + int f = 0, a; + + System.out.println("Type number"); + + f = a = sc.nextInt(); for(int i = a-1; i>=1; i--){ f = f * i; } System.out.println("Factorial = " + f); } - public static void fibonacci(int number){ + //sequence of fibonacci + public static void fibonacci(){ + Scanner sc = new Scanner(System.in); + int a = 1; + int b = 1; + int c, number; + System.out.println("Type number"); + number = sc.nextInt(); + System.out.print(a + " "+b+" "); + for(int i = 0; i < number; i++){ + c = a + b; + a = b; + b = c; + System.out.print(c + " "); + } } - - public static void echoNumber(int number){ + //echo verbal value of the number + public static void echoNumber(){ + Scanner sc = new Scanner(System.in); + int number; + System.out.println("Type number"); + number = sc.nextInt(); String[] numbers = {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"}; System.out.println("You type the number "+ numbers[number]); } - public static void main(String[] args) { + public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a; - System.out.println("Type number"); + System.out.println("Choose the program:"); + System.out.println("1-Factorial\n2-Fibonacci\n3-Word value of the number"); + a = sc.nextInt(); + switch (a){ + case 1:factorial(); + break; + case 2:fibonacci(); + break; + case 3:echoNumber(); + break; + default:System.out.println("Select from 1 to 3"); - a = sc.nextInt();//Считываем число + } - echoNumber(a); } } From f228879e9a254ead4835ea88faa9437115085855 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D1=96=D0=B9=20=D0=9F=D1=80=D0=BE?= =?UTF-8?q?=D1=86=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Sat, 10 Oct 2015 21:51:10 +0300 Subject: [PATCH 5/5] Delete main.java --- main.java | 70 ------------------------------------------------------- 1 file changed, 70 deletions(-) delete mode 100644 main.java diff --git a/main.java b/main.java deleted file mode 100644 index caac668..0000000 --- a/main.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.company; - -import java.util.Scanner; - -public class Main { - - - - //get factorial of the number - public static void factorial(){ - Scanner sc = new Scanner(System.in); - int f = 0, a; - - System.out.println("Type number"); - - f = a = sc.nextInt(); - - for(int i = a-1; i>=1; i--){ - f = f * i; - } - System.out.println("Factorial = " + f); - } - - //sequence of fibonacci - public static void fibonacci(){ - Scanner sc = new Scanner(System.in); - int a = 1; - int b = 1; - int c, number; - System.out.println("Type number"); - number = sc.nextInt(); - System.out.print(a + " "+b+" "); - for(int i = 0; i < number; i++){ - c = a + b; - a = b; - b = c; - System.out.print(c + " "); - } - } - //echo verbal value of the number - public static void echoNumber(){ - Scanner sc = new Scanner(System.in); - int number; - System.out.println("Type number"); - number = sc.nextInt(); - String[] numbers = {"Zero", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"}; - System.out.println("You type the number "+ numbers[number]); - } - - public static void main(String[] args) { - Scanner sc = new Scanner(System.in); - - int a; - - System.out.println("Choose the program:"); - System.out.println("1-Factorial\n2-Fibonacci\n3-Word value of the number"); - a = sc.nextInt(); - switch (a){ - case 1:factorial(); - break; - case 2:fibonacci(); - break; - case 3:echoNumber(); - break; - default:System.out.println("Select from 1 to 3"); - - } - - } -}