Bonus task | Lesson 10 | Level 7

Level 7, Lesson 10

"Hey, soldier!"

"Good day, Captain!"

"I've got awesome news for you. Here are some exercises to reinforce your skills. Do them every day and your skills will grow at an insane speed. They were created especially for IntelliJ IDEA."

18
Task
Java Core,  level 7lesson 10
Locked
Shared list
1. Change the Solution class so that it becomes a list. (It must implement the java.util.List interface). 2. The Solution list should only work with Longs. 3. Use the original field. 4. The list will be used by threads, so you need to ensure that all the methods are synchronized.
9
Task
Java Core,  level 7lesson 10
Locked
Comparable
Implement the Comparable interface in the Beach class. Beaches will be used by threads, so you need to ensure that all the methods are synchronized. Implement the compareTo method so that when two beaches are compared the method returns a positive number if the first beach is better or a nega
18
Task
Java Core,  level 7lesson 10
Locked
Pharmacy
Implement the Runnable interface in the Pharmacy and Person classes. All threads should run until isStopped is true. Here's the logic for the Pharmacy class: drugController should make a random drug purchase (getRandomDrug) in a random amount (getRandomCount) and wait 300 ms. Here's the logic for th
5
Task
Java Core,  level 7lesson 10
Locked
Synchronized methods
Set the synchronized modifier only on the methods that need it. The Solution object will be used by threads.
9
Task
Java Core,  level 7lesson 10
Locked
Superfluous synchronization
The synchronized keyword significantly slows a program, so remove unnecessary synchronized statements in methods.
5
Task
Java Core,  level 7lesson 10
Locked
Ironing
Back to the daily grind... Add one synchronized keyword to make diana and steve take turns ironing, since there's only one iron! Hint: Use class-level locking.
5
Task
Java Core,  level 7lesson 10
Locked
ApplicationContext
The ApplicationContext class will be accessible by many threads. Be sure that no data is lost: think about which keyword to put and where.
9
Task
Java Core,  level 7lesson 10
Locked
ATM
Figure out how the program works. During testing, the log was found to contain the following: ..... Deposit 100, account balance 1100 Deposit 100, account balance 1200 Spend 1000, account balance 100 Insufficient money ..... There's a bug: Money is lost when debiting an account. Find and fix the bug.
18
Task
Java Core,  level 7lesson 10
Locked
Transactionality
Make the joinData method transactional, i.e. if it fails, then the data must not be changed. 1. Read 2 file names from the console. 2. Read from the files line by line. Read from the first file into allLines, from the second file — into linesForRemoval. In the joinData method: 3. If the allLines lis
9
Task
Java Core,  level 7lesson 10
Locked
Let's count
1. Make it so that the result is calculated for all the array elements, WITHOUT using Thread.sleep in the main(String[] args) method. 2. Correct the synchronized block so that the values array is filled with 1s

"Those previous exercises were for rookies. I've added some more advanced bonus exercises for the old-timers. Just for veterans."

18
Task
Java Core,  level 7lesson 10
Locked
CRUD
CrUD: Create, Update, Delete. The program runs with one of the following sets of arguments: -c name sex bd -u id name sex bd -d id -i id Argument values: name (String) sex ("m" or "f") bd (birth date in the following format: "04 15 1990") -c (adds a person with the specified arguments to the end of
18
Task
Java Core,  level 7lesson 10
Locked
CRUD 2
Batch CrUD: multiple Creations, Updates, Deletions. The program runs with one of the following sets of arguments: -c name1 sex1 bd1 name2 sex2 bd2 ... -u id1 name1 sex1 bd1 id2 name2 sex2 bd2 ... -d id1 id2 id3 id4 ... -i id1 id2 id3 id4 ... Argument values: name (String) sex ("m" or "f") bd (birth
18
Task
Java Core,  level 7lesson 10
Locked
Restaurant
1. Figure out what the program does. For some reason, the waiter isn't bringing the prepared dishes out to the tables :( 2. Fix the bug. Hint: it's one line
Comments(33)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Manish SinhaLevel 20 , london
26 April, 00:18
@codegym team, thanks for this beautiful tasks.it would be also very useful to provide some source for learning things we have not learnt but been used there or hint that you could learn this before attempting to understand the task like in last task, we have used Qeue and ConcurrentLinkedQueue and so many like serializable in some task , BigDecimal in some task, Bean in some task. I am not sure if it would be helpful for all, but I would really find it useful though. Ball is in your court as you are experts . at last thanks agains I would like to revist these again and again to better understand the concept.
Manish SinhaLevel 20 , london
26 April, 00:39
just reminded me of one more thing. it would be also very grateful if we could unlock the useful links from professor once we reach level and must not lock all the lessons in between just to check the professor lesson I guess. What do you think @ codegym team.
ReginaLevel 41 , Florida
27 April, 16:07
If you have a sufficient amount of the Dark Matter units, you can unlock all the lectures of the level at once. Thus, you will reach the Professor's lectures very soon. Then you can go back to its tasks.
Manish SinhaLevel 20 , london
27 April, 16:32
yes ..I agree. thanks Regina.
AttilaLevel 22
15 April, 20:04
Great Tasks!
Nyerges FerencLevel 18 , Bükkábrány
22 March, 12:48
Byebye 17 - soon I can get stuff for 18+ :-)
MaGaby2280Level 25 , Guatemala City
12 February, 17:26
1022 dark matters... I have a feeling I will need them so much in a near future ;o)
OreganoLevel 24 , Warsaw
12 February, 11:31
Goodbye threads (for a while).. I'm not gonna miss you :D
Michael BrimageLevel 19 , Washington D.C.
5 May, 19:34
NOT!!!
VesaLevel 41 , Kaliningrad
26 January, 17:12
1015. OK, let's go on.
Piotr WikarskiLevel 19 , Birmingham
27 October 2019, 07:28
After fixing the bug in ATM task, the program works the same as before feixing it..
Robert ConstantinescuLevel 25 , Bucharest
30 November 2019, 07:29
not really, after fixing the balance also display 0
JosephLevel 22
24 October 2019, 07:31
The CRUD task made me want to play baseball with my computer. It said I wasn't really adding the person in "-c" when I added them exactly the same way someone else did who got that right. Then it was saying I was increasing the list size with "-u" when I wasn't adding anything to the list in those blocks. After 23 attempts the only way I was able to pass was by using other people's code which sucks because I always try my best to do things on my own.
Manish SinhaLevel 20 , london
26 April, 00:13
yeah..sometimes it happens with some tasks for me as well and this is one of the task I believe.
Brad ReedLevel 18 , Hartford
3 August, 01:25
same honestly.....CRUD and CRUD 2 made me very angry...
Almaz TemirkanovLevel 24 , Bishkek
17 September 2019, 12:47
Restaurant use ................ add(dish) in class cook
Almaz TemirkanovLevel 24 , Bishkek
17 September 2019, 07:18
#1 use hot key 1. alt+insert 2. ctrl+r