Code to move

Report a typo

Imagine you have a service which helps people to move from one place to another. You have boxes for packaging different types of furniture: ArmchairBox for an armchair, FridgeBox for a fridge, but it's not convenient because boxes differ only in volume. Create a universal class Box, which contains furniture of some type and the volume of a box. Add a primary constructor for initializing furniture and volume, which is Int. Complete the methods getBoxVolume() and getFurnitureFromBox() for getting both fields of Box.

 
Write a program in Kotlin
// implement primary constructor and methods
class Box<T> {
fun getBoxVolume()
fun getFurnitureFromBox()
}

// Don't change classes below
class Fridge
class Armchair
___

Create a free account to access the full topic