From 368036690bdb1eef0c7f93367e71d0a481098c3e Mon Sep 17 00:00:00 2001 From: athoob123 Date: Mon, 17 Feb 2025 16:34:20 +0300 Subject: [PATCH] Task done --- src/Main.kt | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/Main.kt b/src/Main.kt index a7a5e00..32a3e92 100644 --- a/src/Main.kt +++ b/src/Main.kt @@ -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!") -} \ No newline at end of file + val myBook = Book("House", "Bobby", 2001) + + println("Title: ${myBook.title}") + println("Author: ${myBook.author}") + println("Year Published: ${myBook.yearPublished}") +} + + + +