Practice

Goals

Implement the fundamental concept of extends and implement.

Step

Each lesson has its module like lesson1 and lesson2. If you don't know what "module" is and how to start. Feel free to ask me at any time.

What you have to do is:

  1. Let the project runnable.
  2. You can write it down in Java or Kotlin. I just added the class and interface as a title. It means you can delete the original file and add your java version.
  3. Don't need to log or show the user interface. I just want to see the logic of your code.

Lesson 1

Goals: Create engine in Main.kt.

  1. The "Engine" must be crafted by Engineer who has "EngineeringLicence"

Lesson 2

Goals: Create 2 engines in Main.kt.

  1. One is made by an engineer who has "EngineeringLicence".
  2. One is made by a steam engine engineer who is Engineer and has "SteamEngineLicence".

Lesson 3

Goals: Create 2 engines and 1 steam engine in Main.kt.

  1. An engine is made by an engineer who has "EngineeringLicence".
  2. An engine is made by a steam engine engineer who has "SteamEngineLicence".
  3. The steam engine is made by a steam engine engineer. and the normal engineer can't make it as the comment said in Main.kt

Lesson 4

Now the government published a law that every engine must be crafted by engineers who have computer science licenses.

Goals: There are two ways to go.

  1. One is made the original engineer get a computer science license.
  2. The other way is to hire new engineers who have computer science licenses.

My comment

Alright, that's it. For all of the above, I try to write as abstract as possible so that you can code it in your way. Don't need to be afraid to make mistakes. Feel free to ask me at any time.