- 3
Help
Написать регулярное выражение, определяющее является ли данная строка шестнадцатеричным идентификатором цвета в HTML. Где #FFFFFF для белого, #000000 для черного, #FF0000 для красного и т.д. – пример правильных выражений: #FFFFFF, #FF3421, #00ff00. – пример неправильных выражений: 232323, f#fddee, #fd2.
16 Answers
+ 2
Sorry, I don't speak your language. However, the code you have posted is not Java and that's the language you've tagged.
Are you trying to use C# code in Java?
+ 1
static void Main(string[] arg) { //🧐
+ 1
На С# это неплохо. На Java будет как ниже:
https://code.sololearn.com/cXuH19s7XO6v/?ref=app
0
Кому написать?
0
мне
0
помогите мне
0
Пиши
0
Покажи свою попытку
0
Написать регулярное выражение, определяющее является ли данная строчка шестнадцатиричным идентификатором цвета в HTML. Где #FFFFFF для белого, #000000 для черного, #FF0000 для красного и т.д. – пример правильных выражений: #FFFFFF, #FF3421, #00ff00. – пример неправильных выражений: 232323, f#fddee, #fd2.
0
using System;
using System.IO;
using System.Collections.Generic;
using System.Net.NetworkInformation;
using System.Threading;
using System.Text.RegularExpressions;
public class TestLambdaExpression
{
public static void Main()
{
List<string> tests = new List<string>() { "#FFFFFF", "#12ABCD", "#FF3421", "#00ff00", "232323", "f#fddee", "#fd2", "FFFFFF", "AAAAAAA", "#ABCDEFGH", "#QQQQQQ", "#######" };
tests.ForEach(e => Valid(e));
Console.ReadLine();
}
static void Valid(string str)
{
Regex rx = new Regex("^#[0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F][0-9A-F]");
if (str.Length == 7 && rx.IsMatch(str.ToUpper()))
Console.WriteLine(str + " is Valid");
else
Console.WriteLine(str + " is NOT Valid");
}
}
0
Ошибка🥲
0
Eror
0
Yes🤔
0
Yes
0
public class Anonymous {
public static void main(String[ ] args) {
String name ="Mrz";
String status = "Anonymous";
int age =36;
double score =97.9;
char group = 'A';
boolean online = true;
int a = 42,b = 11;
System.out.println ("My Name is "+name);
System.out.println ("Age:"+ age);
System.out.println ("Group:"+group);
System.out.println ("Double:"+score);
System.out.println ("Status:"+status);
System.out.println ("Online:"+online);
System.out.println ("Anonymous:"+group);
}
}
https://www.sololearn.com/discuss/3102215/?ref=app
https://code.sololearn.com/c81V1VCHA6AI/?ref=app
https://code.sololearn.com/c3q994d90dOG/?ref=app
https://code.sololearn.com/cggKAIlietch/?ref=app
https://code.sololearn.com/c9MuoZOI2RgT/?ref=app
https://code.sololearn.com/c8yiEDruOZRV/?ref=app
https://code.sololearn.com/chnHB80Q5911/?ref=app
https://code.sololearn.com/cn8zOIaF9b11/?ref=app
https://
- 1
Problem
Using methods, create a program that will, on a given set of scores keyed-in by the user, will compute for the measures of central tendency. Use an array to contain maximum of 25 scores. Create the following method: GetMean, GetMedian. You may refer to the following, how to obtain the result:
Mean - returns the average value of the scores
Median - returns the mid-point value of given scores after sorting
Approach: To solve the problem, follow the below steps:
To find Mean:
At first, find the sum of all the numbers present in the array. Then, simply divide the resulted sum by the size of the array
To find median:
First, simply sort the array
Then, check if the number of elements present in the array is even or odd
If odd, then simply return the mid value of the array
Else, the median is the average of the two middle values
User Input:
Score 1: -5
Score 2: 1
Score 3: 8
Score 4: 7
Score 5: 2
Score 6: 7
Score 7: 10
Score 8: -3
Score 9: 5
Score 10: 1
Score 11: 9
Score 12: 7
Score 13: 9
Score 14: 5
Score