Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions 40230112004/Functions/.gitignore
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions 40230112004/Functions/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions 40230112004/Functions/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions 40230112004/Functions/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.example</groupId>
<artifactId>Functions</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

</project>
95 changes: 95 additions & 0 deletions 40230112004/Functions/src/main/java/org/example/Main.java
Original file line number Diff line number Diff line change
@@ -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);



}
}
5 changes: 5 additions & 0 deletions 40230112004/How to send.txt
Original file line number Diff line number Diff line change
@@ -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