undefined

Final tasks

Java Syntax
Level 9 , Lesson 11
Available

"Hello, soldier!"

"Hello, Captain Squirrels, sir!"

"I have great news for you. Here are some exercises to reinforce your skills. Work on them every day, and your competence will grow exponentially. They were specially designed for IntelliJ IDEA."

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

undefined
3
Task
Java Syntax, level 9, lesson 11
Locked
Dividing by zero
Maybe you've been wanting this for a long time, but you were afraid? Drum roll, please! Today we will divide by zero! You actually can do it, if you're careful. Create a public static void divideByZero method that divides any number by zero, and display the result of division. Wrap the method call in a try-catch block and display the exception's stack trace.
undefined
3
Task
Java Syntax, level 9, lesson 11
Locked
Countdown
Students at the secret CodeGym center were given a task to assess their skills: write a countdown from 10 to 0 to determine how much time is left before the end of this test. Cool, huh? To create a delay, you need to use Thread.sleep(100), and wrap the sleep call in a try-catch block. Time's up!
undefined
6
Task
Java Syntax, level 9, lesson 11
Locked
Method in a try-catch
Each of you at least once in your life has probably entered a password or other text incorrectly. Let's protect a program from accidentally entering "incorrect" data. In this task, the user enters numbers from the keyboard. If he or she enters something else, then an exception-catching method should be triggered and display all previously entered numbers.
undefined
12
Task
Java Syntax, level 9, lesson 11
Locked
What's today's date?
Java has many tools that allow you to work with dates and times. Here we will use a Date object and SimpleDateFormat. Our task is this: the user should enter a date from the keyboard in the format "2013-08-18", and the application must convert the entered date into the format "AUG 18, 2013".
undefined
12
Task
Java Syntax, level 9, lesson 11
Locked
Vowels and consonants
You and I both know very well which letters are vowels and which are consonants. We need to teach these concepts to intelligent robots, so we'll write a program to train them. The user will enter a string from the keyboard. Then a special method will help to split the entered data into two strings: one with all the vowels and another with only the consonants.
undefined
6
Task
Java Syntax, level 9, lesson 11
Locked
A scary fairy tale
Once there were five classes: red riding hood, grandmother, pie, woodcutter, and wolf. Each class has 2 fields: ArrayList killed and ArrayList ate. Create the necessary objects (hood, grandmother, ...). Then arrange the relationships correctly according to who ate and/or killed who to bring to life what happened in the old Terran fairy tale "Little Red Riding Hood".
undefined
3
Task
Java Syntax, level 9, lesson 11
Locked
Static modifiers are out of place
Faint steps could be heard, and then Master Yu Wu, an expert in the art of positioning objects, appeared in the room. He frowned at the code and said what the programmer was afraid to hear: "Where they are needed, the static modifiers are not. Your error herein lies". The master was correct: Rearrange the static modifiers so that the program compiles.
undefined
6
Task
Java Syntax, level 9, lesson 11
Locked
List of number arrays
By Level 9, students are already adept at manipulating arrays and they know a thing or two about lists. Let's unify this knowledge by trying the following task. We'll create a list whose elements are arrays of numbers. Then we'll add to the list five array objects whose lengths are 5, 2, 4, 7, and 0, respectively. Finally, we'll fill the arrays with any data and display them on the screen.
undefined
6
Task
Java Syntax, level 9, lesson 11
Locked
Ten cats
I'd like ten cats and Java expertise, please. Preferably at the same time! Not a problem, hang on: the program has a Cat class with a String variable name. You need to create a Map and add 10 cats represented by (name, Cat) pairs. Then get a Set of all cats from the Map and display it on the screen.
undefined
6
Task
Java Syntax, level 9, lesson 11
Locked
The code won't compile…
A developer pensively scratching her head while reviewing code is a sign that it won't compile! You must resign yourself to such situations and not be nervous. Here's some practice: The program reads in two file names. It copies the first file to the location specified by the second file name. And yes, the program doesn't work. Fix the mistake.
undefined
6
Task
Java Syntax, level 9, lesson 11
Locked
Let's make the code do something useful!
Old task: Enter 2 file names, and copy the first file to the location specified by the second file name. New task: Enter 2 file names, and copy the first file to the location specified by the second file name. If the file to be copied doesn't exist, then the program reports it and reads another source file name and only then reads the destination file name.
undefined
12
Task
Java Syntax, level 9, lesson 11
Locked
Task about algorithms
The inhabitants of Planet Linear Chaos give their children sorting tasks instead of Rubik's cubes. Here's a pastime enjoyed by small ordered isomorphs. Knock yourself out: after the user enters a list of words (and numbers) from the keyboard, the program should display the words in ascending order, and the numbers in descending order.
Comments (41)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
John Level 10 Mansfield United States
2 May 2021
i'm confuses with last task, can we compare a string and a number in string format using isGreaterThan() method?
The Chief Level 11 United States
24 April 2021
At least one of these tasks requires knowledge of certain things (e.g. StringBuffer) we haven't been taught yet. What's the reason behind that?
Rod Johnston Level 13 Melbourne Australia
4 April 2021
Solved my problem - so frustrating. I was able to make the code verify by NOT passing a parameter when I made the method call.
Rod Johnston Level 13 Melbourne Australia
4 April 2021
Anybody else having trouble with verification on Task0919 - Divide by Zero. Verification messgage I get is Code runs fine in IntelliJ.
Guanting Liu Level 13 Springfield United States
30 November 2020
A scary fairy tale is really a mess,I heard this story but not the same stuff lol
Agent Smith Level 38
21 August 2020
A scary fairy tale task uses this version: Wolf ate granmother, then he ate red riding hood and was killed by a woodcutter. How to work with SimpleDateFormat - read this article
Brad Reed Level 19 Hartford United States
8 July 2020
Anyone able to tell me why if I choose to run a code to check it in IntelliJ, it opens and runs a completely different task on its own????
Brad Reed Level 19 Hartford United States
8 July 2020
"Server cannot check tasks" cool....looks like I'm done for the day......
Gellert Varga Level 17 Szekesfehervar Hungary
16 June 2020
The author of the task "Little Red Riding Hood" (0924) probably has a very tricky mindset...:) But the task was nice:)
Blaise Level 20 London United Kingdom
15 May 2020
"The wolf ate a little." What does this mean? There are many different versions of this story. In this case the wolf ate the "hood" and "grandmother".