20.5k views
5 votes
Implement the Tollable interface. It provides one method, pay, that accepts an int (how many dollars to pay), and returns an int (how much is paid).

1 Answer

4 votes

Answer:

Answered below.

Step-by-step explanation:

\**This is written in the Kotlin programming language.**/

interface Tollable{

fun pay(payInDollars: Int) : Int

}

\**Interfaces are used to declare properties and methods that are common to different classes. As a result different classes can extend one interface.

The properties and methods in an interface are not always initialized. Classes extending from the interface are responsible for initializing these properties and methods. In Kotlin, a class can extend from more than one interface.**/

User Praveen M P
by
5.4k points