Question: Using Kotlin NOT JAVA Instructions: This lab will test your knowledge of inheritance in Kotlin 1. Using IDEA (this is the preferred IDE), create a

Instructions: This lab will test your knowledge of inheritance in Kotlin 1. Using IDEA (this is the preferred IDE), create a class called Shape using the following guide: abstract class Shape name : String) { var name = _name fun getAreal { return 0.0; } fun printDimensions() { println("No dimensions"); } } 2. Create 4 additional classes as follows: Shape Square Circle Triangle Equilateral Triangle 3. For each additional class do the following: 1. Have a constructor that takes a name, which it turn invokes the constructor of its superclass. 2. Implement a set Dimensions() method that will take the following parameters: 1. Square: length and height 2. Circle: radius 3. Triangle: 3 sides 4. Equilateral Triangle: 1 side 3. Override the printDimensions() method of the superclass to print the dimensions of the current shape. 4. Override the getArea() method of the superclass to calculate the correct area for each shape. For triangles, use Heron's Formula: area v (s (s-a) (s-b) (s-c)) where a,b, and c are the lengths of the sides, and s 1 the perimeter 5. From your main function (Main.kt - fun main() 1. Create one instance of each class and store each in a variable of type Shape 2. Prompt prompt the user to enter the dimensions for each object (https://www.programiz.com/kotlin-programming/input-output) 3. Once all objects have been created, print the name, dimensions, and area for each object to the screen with appropriate headings (https://kotlinlang.org/docs/typecasts.html) =
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
