From cd316acc103054a3c2745743812fde70b0c1cf55 Mon Sep 17 00:00:00 2001 From: AmirHosseinGolpour Date: Sun, 24 Mar 2024 19:39:55 +0330 Subject: [PATCH 1/8] fullName --- Answers/40230112115/.editorconfig | 3 + Answers/40230112115/.gitignore | 29 +++++ Answers/40230112115/.idea/.gitignore | 3 + Answers/40230112115/.idea/misc.xml | 6 ++ Answers/40230112115/.idea/modules.xml | 8 ++ Answers/40230112115/.idea/vcs.xml | 6 ++ Answers/40230112115/src/Main.java | 149 ++++++++++++++++++++++++++ Answers/40230112115/untitled3.iml | 11 ++ 8 files changed, 215 insertions(+) create mode 100644 Answers/40230112115/.editorconfig create mode 100644 Answers/40230112115/.gitignore create mode 100644 Answers/40230112115/.idea/.gitignore create mode 100644 Answers/40230112115/.idea/misc.xml create mode 100644 Answers/40230112115/.idea/modules.xml create mode 100644 Answers/40230112115/.idea/vcs.xml create mode 100644 Answers/40230112115/src/Main.java create mode 100644 Answers/40230112115/untitled3.iml diff --git a/Answers/40230112115/.editorconfig b/Answers/40230112115/.editorconfig new file mode 100644 index 0000000..c5319e7 --- /dev/null +++ b/Answers/40230112115/.editorconfig @@ -0,0 +1,3 @@ +root = true + +[*] diff --git a/Answers/40230112115/.gitignore b/Answers/40230112115/.gitignore new file mode 100644 index 0000000..f68d109 --- /dev/null +++ b/Answers/40230112115/.gitignore @@ -0,0 +1,29 @@ +### IntelliJ IDEA ### +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/Answers/40230112115/.idea/.gitignore b/Answers/40230112115/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Answers/40230112115/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Answers/40230112115/.idea/misc.xml b/Answers/40230112115/.idea/misc.xml new file mode 100644 index 0000000..779255b --- /dev/null +++ b/Answers/40230112115/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Answers/40230112115/.idea/modules.xml b/Answers/40230112115/.idea/modules.xml new file mode 100644 index 0000000..d626f94 --- /dev/null +++ b/Answers/40230112115/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Answers/40230112115/.idea/vcs.xml b/Answers/40230112115/.idea/vcs.xml new file mode 100644 index 0000000..b2bdec2 --- /dev/null +++ b/Answers/40230112115/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Answers/40230112115/src/Main.java b/Answers/40230112115/src/Main.java new file mode 100644 index 0000000..286f2d4 --- /dev/null +++ b/Answers/40230112115/src/Main.java @@ -0,0 +1,149 @@ +import java.util.Scanner; + +import static java.lang.String.valueOf; + +public class Main +{ + public static void main(String[] args) { + Scanner stringInput = new Scanner(System.in); + } + public static String fullName(String firstName,String lastName) + { + Scanner input = new Scanner(System.in); + firstName = input.next(); + lastName = input.next(); + firstName = firstName.toLowerCase(); + lastName = lastName.toLowerCase(); + String fullname = ""; + char firsta[] = firstName.toCharArray(); + char lasta[] = lastName.toCharArray(); + firsta[0] -= 32; + lasta[0] -= 32; + int n1 = firsta.length; + int n2 = lasta.length; + char fulla[] = new char[n1 + n2 + 1]; + for (int i = 0; i < n1; i++) { + fulla[i] = firsta[i]; + } + fulla[n1] = ' '; + for (int i = 0; i < n2; i++) { + fulla[i + n1 + 1] = lasta[i]; + } + fullname=valueOf(fulla); + return fullname;} + + +// public static String phoneNumber(String phone) +// +// { +// Scanner input = new Scanner(System.in); +// phone = input.next(); +// char[] phoneArray = phone.toCharArray(); +// String newPhone="0"; +// int n=phone.length(); +// while (n!=10 || phoneArray[0]!='9') { +// System.out.println("Worng entry. Try again"); +// phone = input.next(); +// n=phone.length(); +// phoneArray = phone.toCharArray(); +// } +// newPhone+=phone; +// return newPhone; +// } + +// public static String userId(String id) +// { +// Scanner input = new Scanner(System.in); +// int n=0; +// while (n>13 || n<4) { +// id = input.next(); +// n=id.length(); +// if(id.length()>13 || id.length()<4) { +// System.out.println("Worng ID. Try again"); +// } +// } +// return id; +// } + +// public static String getInterests(String interest) +// { +// Scanner input = new Scanner(System.in); +// int i=0; +// interest=""; +// String x="{"; +// while(i<10){ +// interest = input.nextLine(); +// if(interest.length()!=0){ +// x= x+ "\"" + interest+ "\","; +// }else{ +// break; +// } +// i++; +// } +// if(x.length()!=1) { +// x = x.substring(0, x.length() - 1) + "}"; +// }else{ +// x="{}"; +// } +// return x; +// } + +// public static String userFullInformation(String fullName, String phoneNumber, String userID,String interests) +// +// { +// Scanner input = new Scanner(System.in); +// fullName = input.nextLine().trim(); +// phoneNumber = input.nextLine(); +// userID = input.nextLine(); +// interests = input.nextLine(); +// interests=interests.replace("}","").replace("{","").replace(" ","").replace("\"",""); +// String[] interestsArray = interests.split(","); +// String output="Hello! My name is " + fullName + ". My ID is "+ userID + ". Here are some of my interests:"; +// for(int i=0;i64 && (info[i]+x)>90)||(info[i]<123 && info[i]>96 && (info[i]+x)>122)){ +// info[i]+=x; +// info[i]-=26; +// }else if((info[i]<91 && info[i]>64)||(info[i]<123 && info[i]>96)){ +// info[i]+=x; +// } +// } +// String y= new String(info); +// return y; +// } + +// public static String informationDecoder(String information, String shift) +// { +// Scanner input = new Scanner(System.in); +// information = input.nextLine(); +// shift = input.nextLine(); +// int x=Integer.parseInt(shift); +// char[] info= information.toCharArray(); +// int n=info.length; +// for(int i=0 ; i64 && (info[i]-x)<65)||(info[i]<123 && info[i]>96 && (info[i]-x)<97)){ +// info[i]-=x; +// info[i]+=26; +// }else if((info[i]<91 && info[i]>64)||(info[i]<123 && info[i]>96)){ +// info[i]-=x; +// } +// } +// String y= new String(info); +// return y; +// } + +} \ No newline at end of file diff --git a/Answers/40230112115/untitled3.iml b/Answers/40230112115/untitled3.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/Answers/40230112115/untitled3.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file From 1aef912c551e768035469ef49434705c40f85057 Mon Sep 17 00:00:00 2001 From: AmirHosseinGolpour Date: Sun, 24 Mar 2024 19:44:35 +0330 Subject: [PATCH 2/8] phoneNumber --- Answers/40230112115/src/Main.java | 82 +++++++++++++++---------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/Answers/40230112115/src/Main.java b/Answers/40230112115/src/Main.java index 286f2d4..53e6030 100644 --- a/Answers/40230112115/src/Main.java +++ b/Answers/40230112115/src/Main.java @@ -7,49 +7,49 @@ public class Main public static void main(String[] args) { Scanner stringInput = new Scanner(System.in); } - public static String fullName(String firstName,String lastName) - { - Scanner input = new Scanner(System.in); - firstName = input.next(); - lastName = input.next(); - firstName = firstName.toLowerCase(); - lastName = lastName.toLowerCase(); - String fullname = ""; - char firsta[] = firstName.toCharArray(); - char lasta[] = lastName.toCharArray(); - firsta[0] -= 32; - lasta[0] -= 32; - int n1 = firsta.length; - int n2 = lasta.length; - char fulla[] = new char[n1 + n2 + 1]; - for (int i = 0; i < n1; i++) { - fulla[i] = firsta[i]; - } - fulla[n1] = ' '; - for (int i = 0; i < n2; i++) { - fulla[i + n1 + 1] = lasta[i]; - } - fullname=valueOf(fulla); - return fullname;} +// public static String fullName(String firstName,String lastName) +// { +// Scanner input = new Scanner(System.in); +// firstName = input.next(); +// lastName = input.next(); +// firstName = firstName.toLowerCase(); +// lastName = lastName.toLowerCase(); +// String fullname = ""; +// char firsta[] = firstName.toCharArray(); +// char lasta[] = lastName.toCharArray(); +// firsta[0] -= 32; +// lasta[0] -= 32; +// int n1 = firsta.length; +// int n2 = lasta.length; +// char fulla[] = new char[n1 + n2 + 1]; +// for (int i = 0; i < n1; i++) { +// fulla[i] = firsta[i]; +// } +// fulla[n1] = ' '; +// for (int i = 0; i < n2; i++) { +// fulla[i + n1 + 1] = lasta[i]; +// } +// fullname=valueOf(fulla); +// return fullname; +// } -// public static String phoneNumber(String phone) -// -// { -// Scanner input = new Scanner(System.in); -// phone = input.next(); -// char[] phoneArray = phone.toCharArray(); -// String newPhone="0"; -// int n=phone.length(); -// while (n!=10 || phoneArray[0]!='9') { -// System.out.println("Worng entry. Try again"); -// phone = input.next(); -// n=phone.length(); -// phoneArray = phone.toCharArray(); -// } -// newPhone+=phone; -// return newPhone; -// } + public static String phoneNumber(String phone) + { + Scanner input = new Scanner(System.in); + phone = input.next(); + char[] phoneArray = phone.toCharArray(); + String newPhone="0"; + int n=phone.length(); + while (n!=10 || phoneArray[0]!='9') { + System.out.println("Worng entry. Try again"); + phone = input.next(); + n=phone.length(); + phoneArray = phone.toCharArray(); + } + newPhone+=phone; + return newPhone; + } // public static String userId(String id) // { From 73b2d70cf42c06bfcbd090cec016d0709c95edcc Mon Sep 17 00:00:00 2001 From: AmirHosseinGolpour Date: Sun, 24 Mar 2024 19:45:30 +0330 Subject: [PATCH 3/8] userId --- Answers/40230112115/src/Main.java | 52 +++++++++++++++---------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Answers/40230112115/src/Main.java b/Answers/40230112115/src/Main.java index 53e6030..6dd7368 100644 --- a/Answers/40230112115/src/Main.java +++ b/Answers/40230112115/src/Main.java @@ -34,37 +34,37 @@ public static void main(String[] args) { // } - public static String phoneNumber(String phone) - { - Scanner input = new Scanner(System.in); - phone = input.next(); - char[] phoneArray = phone.toCharArray(); - String newPhone="0"; - int n=phone.length(); - while (n!=10 || phoneArray[0]!='9') { - System.out.println("Worng entry. Try again"); - phone = input.next(); - n=phone.length(); - phoneArray = phone.toCharArray(); - } - newPhone+=phone; - return newPhone; - } - -// public static String userId(String id) +// public static String phoneNumber(String phone) // { // Scanner input = new Scanner(System.in); -// int n=0; -// while (n>13 || n<4) { -// id = input.next(); -// n=id.length(); -// if(id.length()>13 || id.length()<4) { -// System.out.println("Worng ID. Try again"); -// } +// phone = input.next(); +// char[] phoneArray = phone.toCharArray(); +// String newPhone="0"; +// int n=phone.length(); +// while (n!=10 || phoneArray[0]!='9') { +// System.out.println("Worng entry. Try again"); +// phone = input.next(); +// n=phone.length(); +// phoneArray = phone.toCharArray(); // } -// return id; +// newPhone+=phone; +// return newPhone; // } + public static String userId(String id) + { + Scanner input = new Scanner(System.in); + int n=0; + while (n>13 || n<4) { + id = input.next(); + n=id.length(); + if(id.length()>13 || id.length()<4) { + System.out.println("Worng ID. Try again"); + } + } + return id; + } + // public static String getInterests(String interest) // { // Scanner input = new Scanner(System.in); From 2cc28f93753bb53928d9b9d62da42f9b4eae4ec3 Mon Sep 17 00:00:00 2001 From: AmirHosseinGolpour Date: Sun, 24 Mar 2024 19:46:12 +0330 Subject: [PATCH 4/8] getInterests --- Answers/40230112115/src/Main.java | 62 +++++++++++++++---------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/Answers/40230112115/src/Main.java b/Answers/40230112115/src/Main.java index 6dd7368..720a638 100644 --- a/Answers/40230112115/src/Main.java +++ b/Answers/40230112115/src/Main.java @@ -51,43 +51,43 @@ public static void main(String[] args) { // return newPhone; // } - public static String userId(String id) - { - Scanner input = new Scanner(System.in); - int n=0; - while (n>13 || n<4) { - id = input.next(); - n=id.length(); - if(id.length()>13 || id.length()<4) { - System.out.println("Worng ID. Try again"); - } - } - return id; - } - -// public static String getInterests(String interest) +// public static String userId(String id) // { // Scanner input = new Scanner(System.in); -// int i=0; -// interest=""; -// String x="{"; -// while(i<10){ -// interest = input.nextLine(); -// if(interest.length()!=0){ -// x= x+ "\"" + interest+ "\","; -// }else{ -// break; +// int n=0; +// while (n>13 || n<4) { +// id = input.next(); +// n=id.length(); +// if(id.length()>13 || id.length()<4) { +// System.out.println("Worng ID. Try again"); // } -// i++; -// } -// if(x.length()!=1) { -// x = x.substring(0, x.length() - 1) + "}"; -// }else{ -// x="{}"; // } -// return x; +// return id; // } + public static String getInterests(String interest) + { + Scanner input = new Scanner(System.in); + int i=0; + interest=""; + String x="{"; + while(i<10){ + interest = input.nextLine(); + if(interest.length()!=0){ + x= x+ "\"" + interest+ "\","; + }else{ + break; + } + i++; + } + if(x.length()!=1) { + x = x.substring(0, x.length() - 1) + "}"; + }else{ + x="{}"; + } + return x; + } + // public static String userFullInformation(String fullName, String phoneNumber, String userID,String interests) // // { From 3eb05ae677a39218e7db9469199016a5cf70c086 Mon Sep 17 00:00:00 2001 From: AmirHosseinGolpour Date: Sun, 24 Mar 2024 19:46:58 +0330 Subject: [PATCH 5/8] userFullInformation --- Answers/40230112115/src/Main.java | 72 +++++++++++++++---------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/Answers/40230112115/src/Main.java b/Answers/40230112115/src/Main.java index 720a638..569d7dc 100644 --- a/Answers/40230112115/src/Main.java +++ b/Answers/40230112115/src/Main.java @@ -65,47 +65,47 @@ public static void main(String[] args) { // return id; // } - public static String getInterests(String interest) - { - Scanner input = new Scanner(System.in); - int i=0; - interest=""; - String x="{"; - while(i<10){ - interest = input.nextLine(); - if(interest.length()!=0){ - x= x+ "\"" + interest+ "\","; - }else{ - break; - } - i++; - } - if(x.length()!=1) { - x = x.substring(0, x.length() - 1) + "}"; - }else{ - x="{}"; - } - return x; - } - -// public static String userFullInformation(String fullName, String phoneNumber, String userID,String interests) -// +// public static String getInterests(String interest) // { // Scanner input = new Scanner(System.in); -// fullName = input.nextLine().trim(); -// phoneNumber = input.nextLine(); -// userID = input.nextLine(); -// interests = input.nextLine(); -// interests=interests.replace("}","").replace("{","").replace(" ","").replace("\"",""); -// String[] interestsArray = interests.split(","); -// String output="Hello! My name is " + fullName + ". My ID is "+ userID + ". Here are some of my interests:"; -// for(int i=0;i Date: Sun, 24 Mar 2024 19:47:55 +0330 Subject: [PATCH 6/8] informationEncoder --- Answers/40230112115/src/Main.java | 64 +++++++++++++++---------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/Answers/40230112115/src/Main.java b/Answers/40230112115/src/Main.java index 569d7dc..0fc2af7 100644 --- a/Answers/40230112115/src/Main.java +++ b/Answers/40230112115/src/Main.java @@ -88,44 +88,44 @@ public static void main(String[] args) { // return x; // } - public static String userFullInformation(String fullName, String phoneNumber, String userID,String interests) +// public static String userFullInformation(String fullName, String phoneNumber, String userID,String interests) +// +// { +// Scanner input = new Scanner(System.in); +// fullName = input.nextLine().trim(); +// phoneNumber = input.nextLine(); +// userID = input.nextLine(); +// interests = input.nextLine(); +// interests=interests.replace("}","").replace("{","").replace(" ","").replace("\"",""); +// String[] interestsArray = interests.split(","); +// String output="Hello! My name is " + fullName + ". My ID is "+ userID + ". Here are some of my interests:"; +// for(int i=0;i64 && (info[i]+x)>90)||(info[i]<123 && info[i]>96 && (info[i]+x)>122)){ + info[i]+=x; + info[i]-=26; + }else if((info[i]<91 && info[i]>64)||(info[i]<123 && info[i]>96)){ + info[i]+=x; + } } - output=output+"\n\n"+"You can reach me via my phone number "+phoneNumber+"."; - return output; + String y= new String(info); + return y; } -// public static String informationEncoder(String information, String shift) -// { -// Scanner input = new Scanner(System.in); -// information = input.nextLine(); -// shift = input.nextLine(); -// int x=Integer.parseInt(shift); -// char[] info= information.toCharArray(); -// int n=info.length; -// for(int i=0 ; i64 && (info[i]+x)>90)||(info[i]<123 && info[i]>96 && (info[i]+x)>122)){ -// info[i]+=x; -// info[i]-=26; -// }else if((info[i]<91 && info[i]>64)||(info[i]<123 && info[i]>96)){ -// info[i]+=x; -// } -// } -// String y= new String(info); -// return y; -// } - // public static String informationDecoder(String information, String shift) // { // Scanner input = new Scanner(System.in); From 08f6c6d2e38a8382aac3699922c6e9fdb4cbb55a Mon Sep 17 00:00:00 2001 From: AmirHosseinGolpour Date: Sun, 24 Mar 2024 19:48:26 +0330 Subject: [PATCH 7/8] informationDecoder --- Answers/40230112115/src/Main.java | 50 +++++++++++++++---------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/Answers/40230112115/src/Main.java b/Answers/40230112115/src/Main.java index 0fc2af7..43e1438 100644 --- a/Answers/40230112115/src/Main.java +++ b/Answers/40230112115/src/Main.java @@ -106,27 +106,7 @@ public static void main(String[] args) { // return output; // } - public static String informationEncoder(String information, String shift) - { - Scanner input = new Scanner(System.in); - information = input.nextLine(); - shift = input.nextLine(); - int x=Integer.parseInt(shift); - char[] info= information.toCharArray(); - int n=info.length; - for(int i=0 ; i64 && (info[i]+x)>90)||(info[i]<123 && info[i]>96 && (info[i]+x)>122)){ - info[i]+=x; - info[i]-=26; - }else if((info[i]<91 && info[i]>64)||(info[i]<123 && info[i]>96)){ - info[i]+=x; - } - } - String y= new String(info); - return y; - } - -// public static String informationDecoder(String information, String shift) +// public static String informationEncoder(String information, String shift) // { // Scanner input = new Scanner(System.in); // information = input.nextLine(); @@ -135,15 +115,35 @@ public static String informationEncoder(String information, String shift) // char[] info= information.toCharArray(); // int n=info.length; // for(int i=0 ; i64 && (info[i]-x)<65)||(info[i]<123 && info[i]>96 && (info[i]-x)<97)){ -// info[i]-=x; -// info[i]+=26; +// if((info[i]<91 && info[i]>64 && (info[i]+x)>90)||(info[i]<123 && info[i]>96 && (info[i]+x)>122)){ +// info[i]+=x; +// info[i]-=26; // }else if((info[i]<91 && info[i]>64)||(info[i]<123 && info[i]>96)){ -// info[i]-=x; +// info[i]+=x; // } // } // String y= new String(info); // return y; // } + public static String informationDecoder(String information, String shift) + { + Scanner input = new Scanner(System.in); + information = input.nextLine(); + shift = input.nextLine(); + int x=Integer.parseInt(shift); + char[] info= information.toCharArray(); + int n=info.length; + for(int i=0 ; i64 && (info[i]-x)<65)||(info[i]<123 && info[i]>96 && (info[i]-x)<97)){ + info[i]-=x; + info[i]+=26; + }else if((info[i]<91 && info[i]>64)||(info[i]<123 && info[i]>96)){ + info[i]-=x; + } + } + String y= new String(info); + return y; + } + } \ No newline at end of file From eb318e79b1c4bb1d73d58719f2b298ed18d698fd Mon Sep 17 00:00:00 2001 From: AmirHosseinGolpour Date: Sun, 24 Mar 2024 19:49:46 +0330 Subject: [PATCH 8/8] all --- Answers/40230112115/src/Main.java | 222 +++++++++++++++--------------- 1 file changed, 111 insertions(+), 111 deletions(-) diff --git a/Answers/40230112115/src/Main.java b/Answers/40230112115/src/Main.java index 43e1438..89e2539 100644 --- a/Answers/40230112115/src/Main.java +++ b/Answers/40230112115/src/Main.java @@ -7,124 +7,124 @@ public class Main public static void main(String[] args) { Scanner stringInput = new Scanner(System.in); } -// public static String fullName(String firstName,String lastName) -// { -// Scanner input = new Scanner(System.in); -// firstName = input.next(); -// lastName = input.next(); -// firstName = firstName.toLowerCase(); -// lastName = lastName.toLowerCase(); -// String fullname = ""; -// char firsta[] = firstName.toCharArray(); -// char lasta[] = lastName.toCharArray(); -// firsta[0] -= 32; -// lasta[0] -= 32; -// int n1 = firsta.length; -// int n2 = lasta.length; -// char fulla[] = new char[n1 + n2 + 1]; -// for (int i = 0; i < n1; i++) { -// fulla[i] = firsta[i]; -// } -// fulla[n1] = ' '; -// for (int i = 0; i < n2; i++) { -// fulla[i + n1 + 1] = lasta[i]; -// } -// fullname=valueOf(fulla); -// return fullname; -// } + public static String fullName(String firstName,String lastName) + { + Scanner input = new Scanner(System.in); + firstName = input.next(); + lastName = input.next(); + firstName = firstName.toLowerCase(); + lastName = lastName.toLowerCase(); + String fullname = ""; + char firsta[] = firstName.toCharArray(); + char lasta[] = lastName.toCharArray(); + firsta[0] -= 32; + lasta[0] -= 32; + int n1 = firsta.length; + int n2 = lasta.length; + char fulla[] = new char[n1 + n2 + 1]; + for (int i = 0; i < n1; i++) { + fulla[i] = firsta[i]; + } + fulla[n1] = ' '; + for (int i = 0; i < n2; i++) { + fulla[i + n1 + 1] = lasta[i]; + } + fullname=valueOf(fulla); + return fullname; + } -// public static String phoneNumber(String phone) -// { -// Scanner input = new Scanner(System.in); -// phone = input.next(); -// char[] phoneArray = phone.toCharArray(); -// String newPhone="0"; -// int n=phone.length(); -// while (n!=10 || phoneArray[0]!='9') { -// System.out.println("Worng entry. Try again"); -// phone = input.next(); -// n=phone.length(); -// phoneArray = phone.toCharArray(); -// } -// newPhone+=phone; -// return newPhone; -// } + public static String phoneNumber(String phone) + { + Scanner input = new Scanner(System.in); + phone = input.next(); + char[] phoneArray = phone.toCharArray(); + String newPhone="0"; + int n=phone.length(); + while (n!=10 || phoneArray[0]!='9') { + System.out.println("Worng entry. Try again"); + phone = input.next(); + n=phone.length(); + phoneArray = phone.toCharArray(); + } + newPhone+=phone; + return newPhone; + } -// public static String userId(String id) -// { -// Scanner input = new Scanner(System.in); -// int n=0; -// while (n>13 || n<4) { -// id = input.next(); -// n=id.length(); -// if(id.length()>13 || id.length()<4) { -// System.out.println("Worng ID. Try again"); -// } -// } -// return id; + public static String userId(String id) + { + Scanner input = new Scanner(System.in); + int n=0; + while (n>13 || n<4) { + id = input.next(); + n=id.length(); + if(id.length()>13 || id.length()<4) { + System.out.println("Worng ID. Try again"); + } + } + return id; // } -// public static String getInterests(String interest) -// { -// Scanner input = new Scanner(System.in); -// int i=0; -// interest=""; -// String x="{"; -// while(i<10){ -// interest = input.nextLine(); -// if(interest.length()!=0){ -// x= x+ "\"" + interest+ "\","; -// }else{ -// break; -// } -// i++; -// } -// if(x.length()!=1) { -// x = x.substring(0, x.length() - 1) + "}"; -// }else{ -// x="{}"; -// } -// return x; -// } + public static String getInterests(String interest) + { + Scanner input = new Scanner(System.in); + int i=0; + interest=""; + String x="{"; + while(i<10){ + interest = input.nextLine(); + if(interest.length()!=0){ + x= x+ "\"" + interest+ "\","; + }else{ + break; + } + i++; + } + if(x.length()!=1) { + x = x.substring(0, x.length() - 1) + "}"; + }else{ + x="{}"; + } + return x; + } -// public static String userFullInformation(String fullName, String phoneNumber, String userID,String interests) -// -// { -// Scanner input = new Scanner(System.in); -// fullName = input.nextLine().trim(); -// phoneNumber = input.nextLine(); -// userID = input.nextLine(); -// interests = input.nextLine(); -// interests=interests.replace("}","").replace("{","").replace(" ","").replace("\"",""); -// String[] interestsArray = interests.split(","); -// String output="Hello! My name is " + fullName + ". My ID is "+ userID + ". Here are some of my interests:"; -// for(int i=0;i64 && (info[i]+x)>90)||(info[i]<123 && info[i]>96 && (info[i]+x)>122)){ -// info[i]+=x; -// info[i]-=26; -// }else if((info[i]<91 && info[i]>64)||(info[i]<123 && info[i]>96)){ -// info[i]+=x; -// } -// } -// String y= new String(info); -// return y; -// } + { + Scanner input = new Scanner(System.in); + fullName = input.nextLine().trim(); + phoneNumber = input.nextLine(); + userID = input.nextLine(); + interests = input.nextLine(); + interests=interests.replace("}","").replace("{","").replace(" ","").replace("\"",""); + String[] interestsArray = interests.split(","); + String output="Hello! My name is " + fullName + ". My ID is "+ userID + ". Here are some of my interests:"; + for(int i=0;i64 && (info[i]+x)>90)||(info[i]<123 && info[i]>96 && (info[i]+x)>122)){ + info[i]+=x; + info[i]-=26; + }else if((info[i]<91 && info[i]>64)||(info[i]<123 && info[i]>96)){ + info[i]+=x; + } + } + String y= new String(info); + return y; + } public static String informationDecoder(String information, String shift) {