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..bd90e2d --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,494 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 0000000..9252565 Binary files /dev/null and b/out/production/lesson0/com/company/Main.class differ diff --git a/src/com/company/Main.java b/src/com/company/Main.java new file mode 100644 index 0000000..caac668 --- /dev/null +++ b/src/com/company/Main.java @@ -0,0 +1,70 @@ +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"); + + } + + } +}