From 53de847e726ee23b0daa94802e238faa641f9f69 Mon Sep 17 00:00:00 2001 From: Amirhoseinhmd83 Date: Sun, 17 Mar 2024 03:12:18 +0330 Subject: [PATCH 1/6] Function1 is finished --- .idea/.name | 1 + .idea/Functions-Introduction.iml | 13 ++ .idea/misc.xml | 6 + .idea/modules.xml | 8 + .idea/uiDesigner.xml | 124 +++++++++++ .idea/vcs.xml | 6 + .idea/workspace.xml | 204 ++++++++++++++++++ Answers/40230212031/.idea/.gitignore | 8 + Answers/40230212031/.idea/.name | 1 + Answers/40230212031/.idea/misc.xml | 6 + Answers/40230212031/.idea/modules.xml | 8 + Answers/40230212031/.idea/vcs.xml | 6 + .../src/org/example/Functions.java | 16 ++ Answers/40230212031/src/org/example/Main.java | 22 ++ 14 files changed, 429 insertions(+) create mode 100644 .idea/.name create mode 100644 .idea/Functions-Introduction.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/uiDesigner.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 Answers/40230212031/.idea/.gitignore create mode 100644 Answers/40230212031/.idea/.name create mode 100644 Answers/40230212031/.idea/misc.xml create mode 100644 Answers/40230212031/.idea/modules.xml create mode 100644 Answers/40230212031/.idea/vcs.xml create mode 100644 Answers/40230212031/src/org/example/Functions.java create mode 100644 Answers/40230212031/src/org/example/Main.java diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..299bc21 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +Function-Introduction \ No newline at end of file diff --git a/.idea/Functions-Introduction.iml b/.idea/Functions-Introduction.iml new file mode 100644 index 0000000..d9bf4c6 --- /dev/null +++ b/.idea/Functions-Introduction.iml @@ -0,0 +1,13 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..cecb8d5 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..95e372b --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ 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..73bf959 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,204 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + { + "associatedIndex": 2 +} + + + + + + + + + + + + + + + + + + + + + 1710356437818 + + + + + + + + + + + + + file://$APPLICATION_CONFIG_DIR$/scratches/scratch.java + 1 + + + + + + + \ No newline at end of file diff --git a/Answers/40230212031/.idea/.gitignore b/Answers/40230212031/.idea/.gitignore new file mode 100644 index 0000000..13566b8 --- /dev/null +++ b/Answers/40230212031/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/Answers/40230212031/.idea/.name b/Answers/40230212031/.idea/.name new file mode 100644 index 0000000..002da1d --- /dev/null +++ b/Answers/40230212031/.idea/.name @@ -0,0 +1 @@ +Main.java \ No newline at end of file diff --git a/Answers/40230212031/.idea/misc.xml b/Answers/40230212031/.idea/misc.xml new file mode 100644 index 0000000..07115cd --- /dev/null +++ b/Answers/40230212031/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Answers/40230212031/.idea/modules.xml b/Answers/40230212031/.idea/modules.xml new file mode 100644 index 0000000..9a73810 --- /dev/null +++ b/Answers/40230212031/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Answers/40230212031/.idea/vcs.xml b/Answers/40230212031/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/Answers/40230212031/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Answers/40230212031/src/org/example/Functions.java b/Answers/40230212031/src/org/example/Functions.java new file mode 100644 index 0000000..9b48977 --- /dev/null +++ b/Answers/40230212031/src/org/example/Functions.java @@ -0,0 +1,16 @@ +package org.example; + + public class Functions { + public String normalizingName (String firstName, String lastName) { + String normalizedFirstName = firstName.substring(0, 1).toUpperCase() + firstName.substring(1).toLowerCase(); + //ابتدا حرف اول first name را با شروع اندیس از 0 و در نظر گرفتن پایان کلمه در اندیس 1 جدا کرده و به بزگ تبدیل میکنیم +// و بعد از ان از اندیس یک به بعد همه ی حروف را به کوچک تبدیل میکنیم + + String normalizedLastName = lastName.substring(0, 1).toUpperCase() + lastName.substring(1).toLowerCase(); +//مانند بالایی + return normalizedFirstName +" "+normalizedLastName; + } + +} + + diff --git a/Answers/40230212031/src/org/example/Main.java b/Answers/40230212031/src/org/example/Main.java new file mode 100644 index 0000000..607abb2 --- /dev/null +++ b/Answers/40230212031/src/org/example/Main.java @@ -0,0 +1,22 @@ +package org.example; + +import java.util.Scanner; + +public class Main { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + + System.out.print("Enter your first name: "); + String firstName = scanner.nextLine(); + + System.out.print("Enter your last name: "); + String lastName = scanner.nextLine(); + + Functions functions = new Functions(); + String normalizedName = functions.normalizingName(firstName, lastName); + + System.out.println("Normalized name: " + normalizedName); + + } +} + From ec46bcddb0195d6f8a103b9693c645d9c3434fa5 Mon Sep 17 00:00:00 2001 From: Amirhoseinhmd83 Date: Sun, 17 Mar 2024 14:39:45 +0330 Subject: [PATCH 2/6] function2 is finished --- .idea/workspace.xml | 12 ++++-------- .../40230212031/src/org/example/Functions.java | 12 +++++++++++- Answers/40230212031/src/org/example/Main.java | 17 +++++++++++++++++ 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 73bf959..9e5344b 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,13 +5,9 @@ - - - - - - - + + + diff --git a/Answers/40230212031/src/org/example/Functions.java b/Answers/40230212031/src/org/example/Functions.java index 9b48977..bd214d8 100644 --- a/Answers/40230212031/src/org/example/Functions.java +++ b/Answers/40230212031/src/org/example/Functions.java @@ -10,7 +10,17 @@ public String normalizingName (String firstName, String lastName) { //مانند بالایی return normalizedFirstName +" "+normalizedLastName; } + public String formatPhoneNumber(String phoneNumber) { + if (checking(phoneNumber)) { + return "0" + phoneNumber; + } else { + return "Wrong entry. Try again."; + } + } + public boolean checking(String phone) { + return phone.startsWith("9") && phone.length() == 10; + } + } -} diff --git a/Answers/40230212031/src/org/example/Main.java b/Answers/40230212031/src/org/example/Main.java index 607abb2..cf69406 100644 --- a/Answers/40230212031/src/org/example/Main.java +++ b/Answers/40230212031/src/org/example/Main.java @@ -16,6 +16,23 @@ public static void main(String[] args) { String normalizedName = functions.normalizingName(firstName, lastName); System.out.println("Normalized name: " + normalizedName); +////////////////////////////////////////////////////////////////////// + + System.out.print("Enter phone number: "); + String phone = scanner.nextLine(); + + while (!functions.checking(phone)) { + //اگر شماره وارد شده توسط کاربر صحیح نبود + System.out.println("Wrong entry. Try again."); + System.out.print("Enter phone number: "); + phone = scanner.nextLine(); + //دریافت مجدد شماره توسط کاربر + } + + String formattedPhone = functions.formatPhoneNumber(phone); + //در اینجا شماره قطغا درسته و به کاربر نمایش داده میشود + System.out.println("Output: " + formattedPhone); + } } From ab35bbb49c98099ac9196641f020d2c775be34f4 Mon Sep 17 00:00:00 2001 From: Amirhoseinhmd83 Date: Sun, 17 Mar 2024 17:14:06 +0330 Subject: [PATCH 3/6] function3 is finished --- .idea/Functions-Introduction.iml | 9 +++++++++ .idea/workspace.xml | 12 +++++++++++- .../40230212031/src/org/example/Functions.java | 17 +++++++++++++++-- Answers/40230212031/src/org/example/Main.java | 13 +++++++++---- 4 files changed, 44 insertions(+), 7 deletions(-) diff --git a/.idea/Functions-Introduction.iml b/.idea/Functions-Introduction.iml index d9bf4c6..1e317c5 100644 --- a/.idea/Functions-Introduction.iml +++ b/.idea/Functions-Introduction.iml @@ -9,5 +9,14 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 9e5344b..4065b05 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -5,6 +5,7 @@ + @@ -55,7 +56,11 @@ "Application.Functions.executor": "Run", "Application.Main.executor": "Run", "Application.NameFormatter.executor": "Run", + "Downloaded.Files.Path.Enabled": "false", "JUnit.Unnamed.executor": "Coverage", + "Repository.Attach.Annotations": "false", + "Repository.Attach.JavaDocs": "false", + "Repository.Attach.Sources": "false", "RunOnceActivity.OpenProjectViewOnStart": "true", "RunOnceActivity.ShowReadmeOnStart": "true", "git-widget-placeholder": "main", @@ -164,7 +169,7 @@ - + @@ -194,6 +199,11 @@