This week's giveaway is in the Spring forum.
We're giving away four copies of Microservices Testing (Live Project) and have Chris Love & Andres Sacco on-line!
See this thread for details.
Win a copy of Microservices Testing (Live Project) this week in the Spring forum!

Cris Marinescu

Greenhorn
+ Follow
since May 11, 2022
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
3
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Cris Marinescu

"Do you know how to use the compiler?"  -> Yes, I do know.
"So add a field "figure" and a field "type" to your class that will hold that information about a playing card, and assign them from the constructor parameters." -> I hope it's okay how I did it.



I tested my solution and it worked. Thank you very much for your hints. It helped me a lot!
2 months ago
I'm thinking to continue like this or should I use a boolean method?
It's not clear how i use those parametres of contructor. I will look in documentation and I will return with a better code

2 months ago
I did like this till now, but I'm trying to figure out how to continue. I suppose it's a much efficient solution

2 months ago
I need to write the implementation of a GameCard class that stores the information corresponding to a card. The class must have 2 private fields: a String that saves the figure (7, 8, 9, 10, J, Q, K or A) and a String that saves the type of playing card (RED HEART, BLACK HEART, CLOVER or CARO) . The class will have a constructor that receives a String and a String as parameters and throws a GameException exception, also defined by you, if one of the parameters is not part of the variants listed above.

The thrown exception message must be Invalid Figure if the first parameter is invalid, Invalid Type if the second parameter is invalid, or Invalid Figure and Type if none of the above parameters follow the rules.

This is what I tried, but i dont know how to continue:

   Copy Code
   private List<String> figure = Arrays.asList("7", "8", "9", "10", "J", "Q", "K", "A")

   Copy Code
   private List<String> type = Arrays.asList("RED HEART", "BLACK HEART", "CLOVER", "CARO")
2 months ago
I was thinking of creating a method that should return the number of valid dates. How can I use SimpleDateFormat?

class ValidatorDate {
public static int ValidDates(String[] words) {
   DateFormat format = new SimpleDateFormat("dd/MM/yyyy");
   format.setLenient(false);
   }
}


public class Main {
public static void main(String[] args) {
   System.out.println(ValidatorDate.ValidDates(new String[]{"car","bench","01/04/2019",  "01/13/2019", "29/02/200s"}));
   // answer: 2(01/04/2019 and 29/02/200s are valid dates)
 }
}
2 months ago
"Is it a requirement that you use regular expressions?" - Yes
"Why are you printing the number of words minus 1?" - my mistake, I fix it.
"Presumably because otherwise your output doesn't match the expected output for the given input data."- Exactly. I receive a wrong answer at the last test when I'm submitting my solution on the platform where I'm learning.
3 months ago
Input data
You will read the text of the email from the keyboard. It can span multiple lines and contains only lowercase letters of the English alphabet and spaces.

Output data
A single integer will be displayed, representing the number of distinct words in the email

limitation
The text does not contain more than 100,000 words, and each word can contain up to 25 characters.

Input data:
thanks for the list of shopping
Is helpful
thanks

Output data:
7

What I have tried:

3 months ago