Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions src/Main.kt
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@

class Book {
var title: String = "House"
val author: String = "Bobby"
var yearPublished: Int = 2001
}
fun main () {
val myBook = Book()

myBook.title = "House"
myBook.author = "Bobby Lee"
myBook.yearPublished = 2001
}

class Book(val title: String, val author: String, val yearPublished: Int) {
fun getBookInfo(): String {
return "$title by $author ($yearPublished)"
}
fun main() {
println("Hello World!")
}
val myBook = Book("House", "Bobby", 2001)

println("Title: ${myBook.title}")
println("Author: ${myBook.author}")
println("Year Published: ${myBook.yearPublished}")
}