undefined

Bonus task | Lesson 8 | Level 4

Java Core
Level 4 , Lesson 8
Available

"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."

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

undefined
8
Task
Java Core, level 4, lesson 8
Locked
Bridges
Create a Bridge interface with a getCarsCount() method that counts cars. Write WaterBridge and SuspensionBridge classes that implement this interface. The getCarsCount() method must return any constant int value. This value must be different for different classes.
undefined
8
Task
Java Core, level 4, lesson 8
Locked
Wine tasting
30% of the robots on Planet Soto have an alcohol dependence, which causes anxiety among the remaining 70%. More precisely, the 30% are addicted to alcohol-related programs. We are talking about robots, after all. But now it's your chance to do the same!
undefined
16
Task
Java Core, level 4, lesson 8
Locked
User, loser, coder and programmer
1. Enter a few strings (keys) from the keyboard [in a loop]. The following strings (keys) are allowed: "user", "loser", "coder", "programmer". Stop reading in strings after reading in any string that does not match one of the above. 2. For each entered string: 2.1. Create the appropriate object [see Person.java], e.g.
undefined
4
Task
Java Core, level 4, lesson 8
Locked
Implement the printMainInfo method
Write an implementation of the printMainInfo method: * If a Drawable object is passed to the method, call the draw method on the object. * If a Movable object is passed to the method, call the move method on the object.
undefined
8
Task
Java Core, level 4, lesson 8
Locked
Computer
We're using programming and OOP tools to build a new computer for work. We won't just have a Computer class. We'll also have a CompItem interface that will be implemented by the Computer class.
undefined
16
Task
Java Core, level 4, lesson 8
Locked
MovieFactory
You have the code for a MovieFactory program. Figure out what it does. Add Cartoon and Thriller classes. Understand how we get a SoapOpera object using the key "soapOpera".
undefined
8
Task
Java Core, level 4, lesson 8
Locked
Janitorial services
Let's create a virtual janitorial business with a cleanAllApartments method for all apartment types and individual methods for cleaning one-, two- and three-bedroom apartments.
undefined
8
Task
Java Core, level 4, lesson 8
Locked
Fixing bugs
Think about how CanSwim and CanWalk interfaces relate to the SeaCreature class. Create the correct inheritance relationship between the interfaces and the SeaCreature class. And how might the Orca, Whale, and RiverOtter classes relate to the SeaCreature class?
undefined
16
Task
Java Core, level 4, lesson 8
Locked
Currencies
Let's do some work with money. Your job is to expand the functionality of a program that can manipulate currencies. For the specific currencies, see the task conditions. To start, create a private double field amount in the abstract Money class...
undefined
8
Task
Java Core, level 4, lesson 8
Locked
Fix four mistakes
This code has four bugs, and your task is... Yeah, you already know what your task is. First of all, you need to figure out what the code does. Create something and fix the bugs that were written before you got involved with the code (as well as any that appear after you get involved).
undefined
8
Task
Java Core, level 4, lesson 8
Locked
Exception invasion
In reality, there are oceans of exceptions in programs, and you'll eventually get used to them. You can start right now: populate the list exceptions with ten (10) different exceptions. The first exception is already implemented in the initExceptions method.
undefined
16
Task
Java Core, level 4, lesson 8
Locked
GCD
We continue our attempts to enter the cosmic space belonging to Planet Linear Chaos. Here's another task taken from a border-crossing interview, for young arrivals: find the greatest common divisor (GCD) of two positive integers.
undefined
8
Task
Java Core, level 4, lesson 8
Locked
Singleton
A class implements the Singleton pattern if it lets you create just one object of its type. You need to create a Singleton class in a separate file. Add a static getInstance method that returns the same object any time it is called. Think about how you can prevent the creation of additional instances of this class.
Comments (36)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
Jokeres Level 22 Budapest Hungary
31 March 2021
Computer task was rly good. I love learning keycombinations to shorten things
Shilpa nori Level 33 Rochester United States
27 January 2021
For gcd task , you just have to throw exception. It took me a while to get that alone right.
ayhem bouabid Level 16 Tunis Tunisia
12 January 2021
Me me = new Myself(); if (me instanceof DevelopperClass) System.out.println("My life is freaking wonderful!!!");
Ron R Level 18 Washington United States
8 January 2021
Movie Factory: Unless I missed it in previous lessons, I had no idea getClass() and getSimpleName() methods were part of the java.lang package. Knowing that would have helped big time. Whelp, now I know.
Agent Smith Level 38
27 August 2020
Exercises are getting more interesting. Good. ^_^
Ryan Level 16 Ashburn United States
20 July 2020
Helpful hints for GCD task: 1. You don't need to catch the exception, you just need to throw one if one of the numbers is not positive (zero is not positive). 2. Ignore the part of requirement 2 that says "If the entered lines can't be converted to positive integers", it should say "If the entered lines are not positive integers (zero is not considered positive)". If you follow this requirement down the converted path you will try Math.abs() and that will mess everything up. The rest of this task is straight forward as long as you interpret requirement #2 with the hints above.
Angel Li Level 18 Fremont United States
5 July 2020
Nice tasks, I think there's a spelling error in Implement the printMainInfo method for movable.
Manish Sinha Level 26 london United Kingdom
8 April 2020
these tasks were really good. very helpful to revise at the end. few things from my side , not sure if really important , but I faced these concerns: 1. in GCD task, you could provide hint as number should be greater than or equal to 0. 2. in last task, you could clearly highlight the field name as instance. It took me help to know the same. Thank-you team for you efforts. it's really helping us in road of becoming junior java developer.
Manish Sinha Level 26 london United Kingdom
7 April 2020
Good one ..I like to get the exercises at last to revise the stuffs...thanks CodeGym team..well done
Thomas Sixberry Level 16 Rochester Hills United States
12 February 2020
My brains gonna learn today!