Практика
This commit is contained in:
+11
-10
@@ -5,18 +5,19 @@ public class TaskDemo {
|
|||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
String name = " евгений ";
|
int[] userId = {101, 102, 103, 104, 105};
|
||||||
System.out.println(formatUserName(name));
|
boolean[] userStatus = {true, false, true, false, true};
|
||||||
|
printPremiumUser(userId, userStatus);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
public static void printPremiumUser (int[] userId, boolean[] userStatus) {
|
||||||
public static String formatUserName(String name) {
|
for (int i = 0; i < userId.length; i++) {
|
||||||
String cleanName = name.trim();
|
if (userStatus[i]) {
|
||||||
String firstLetter = cleanName.substring(0, 1).toUpperCase();
|
System.out.print(userId[i] + " ");
|
||||||
String restOfName = cleanName.substring(1).toLowerCase();
|
}
|
||||||
|
|
||||||
|
|
||||||
return firstLetter + restOfName;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
-18
@@ -1,18 +0,0 @@
|
|||||||
public class U {
|
|
||||||
|
|
||||||
public static void pl (String text) {
|
|
||||||
System.out.println(text);
|
|
||||||
}
|
|
||||||
public static void pl (int number) {
|
|
||||||
System.out.println(number);
|
|
||||||
}
|
|
||||||
public static void pl (double number) {
|
|
||||||
System.out.println(number);
|
|
||||||
}
|
|
||||||
public static void pl (float number) {
|
|
||||||
System.out.println(number);
|
|
||||||
}
|
|
||||||
public static void pl (int[] array) {
|
|
||||||
System.out.println(java.util.Arrays.toString(array));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user