diff --git a/40230112004/Functions/.gitignore b/40230112004/Functions/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/40230112004/Functions/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/40230112004/Functions/.idea/.gitignore b/40230112004/Functions/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/40230112004/Functions/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/40230112004/Functions/.idea/misc.xml b/40230112004/Functions/.idea/misc.xml new file mode 100644 index 0000000..82dbec8 --- /dev/null +++ b/40230112004/Functions/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + \ No newline at end of file diff --git a/40230112004/Functions/pom.xml b/40230112004/Functions/pom.xml new file mode 100644 index 0000000..5fff184 --- /dev/null +++ b/40230112004/Functions/pom.xml @@ -0,0 +1,17 @@ + + + 4.0.0 + + org.example + Functions + 1.0-SNAPSHOT + + + 17 + 17 + UTF-8 + + + \ No newline at end of file diff --git a/40230112004/Functions/src/main/java/org/example/Main.java b/40230112004/Functions/src/main/java/org/example/Main.java new file mode 100644 index 0000000..7e595bb --- /dev/null +++ b/40230112004/Functions/src/main/java/org/example/Main.java @@ -0,0 +1,95 @@ +package org.example; + + +import java.util.Scanner; + +public class Main { + static Scanner scanner = new Scanner(System.in); + public static String normalizer(String name) + { + return name.substring(0,1).toUpperCase() + name.substring(1).toLowerCase(); + } + public static String fullName(String firstName, String lastName) + { + String resultFirstName =normalizer(firstName); + String resultLastName = normalizer(lastName); + + return (resultFirstName + " " + resultLastName); + + } + public static String phoneNumber(String number) + { + + if(number.length() == 10 && number.charAt(0)=='9') + { + return ("0"+number); + } + else + { + System.out.println("wrong entry. try again"); + phoneNumber(scanner.nextLine()); + } + return null; + + } + public static String userId(String Id) + { + if (Id.length()>4 && Id.length()<13) + { + return Id; + } + else + { + System.out.println("wrong entry. try again"); + userId(scanner.nextLine()); + } + return null; + + } + + public static String[] getInterests (String interests) { + + String[] interestsList = new String[10]; + for( int interestsListIndex = 0; interestsListIndex < 10; interestsListIndex++) + { + if (interests.equals("done")) + { + break; + } + interestsList[interestsListIndex] = interests; + interests = scanner.nextLine(); + } + return interestsList; + + + + + + + } + public static void userFullInformation (String fullName , String phoneNumber, String userId , String [] interests) + { + System.out.println("Hello! My name is "+fullName+". My Id is "+userId+"Here are my interests: "); + for(int i = 0 ; i< interests.length ; i++) + { + System.out.println(i + "."+ interests[i]); + } + System.out.println("You can reach me via my phone number : " + phoneNumber); + } + + public static void main(String[] args) + { + System.out.print("Please enter your name: "); + String fullNameHolder = fullName(scanner.nextLine(),scanner.nextLine()); + System.out.print("Please enter your phone number: "); + String phoneNumberHolder = phoneNumber(scanner.nextLine()); + System.out.print("Please enter your user Id: "); + String userIdHolder = userId(scanner.nextLine()); + System.out.println("Please share your interests: "); + String [] interestsHolder = getInterests(scanner.nextLine()); + userFullInformation(fullNameHolder,phoneNumberHolder,userIdHolder,interestsHolder); + + + + } +} \ No newline at end of file diff --git a/40230112004/How to send.txt b/40230112004/How to send.txt new file mode 100644 index 0000000..ad302cf --- /dev/null +++ b/40230112004/How to send.txt @@ -0,0 +1,5 @@ +1.put your project in Answers folder. +2.change the name of your folder to your student ID +3.commit each function that implemented. +4.push your commits +5.after you've finished your project, pull request to original repository