Question: Kotlin please Create a class named Location. Location should define a primary single constructor that accepts three fields: a String (the description), a Double (the
Kotlin please

Create a class named Location. Location should define a primary single constructor that accepts three fields: a String (the description), a Double (the latitude) and an Double (the longitude). You are welcome to name these fields however you like, and they should be private. Your constructor should reject invalid latitude and longitude values. Valid longitude values are between 180.0 and 180.0, inclusive, while valid latitude values are between 90.0 and 90.0, inclusive. You do not need to provide any getters and setters! Instead, define a single method named equals. Your equals method accepts an Any? as a single parameter. It should return true if the passed object is a Location and has the same position, and false otherwise
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
