From f0ebd66c5f984ca42d583b058a69c4a9b6b80fc1 Mon Sep 17 00:00:00 2001 From: Abdulwahab-Alawadhi Date: Sun, 16 Feb 2025 18:55:24 +0300 Subject: [PATCH] done --- src/task1.kt | 20 ++++++++++++++++++++ src/task2&3.kt | 18 ++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/task1.kt create mode 100644 src/task2&3.kt diff --git a/src/task1.kt b/src/task1.kt new file mode 100644 index 0000000..0d140bc --- /dev/null +++ b/src/task1.kt @@ -0,0 +1,20 @@ +fun main() { + + var book = Book() + book.title ="Harry Potter" + book.author="Jk Rowing" + book.yearPublished=2000 + book.printBook() +} + + +class Book{ + var title: String="" + var author: String="" + var yearPublished: Int=0 + + fun printBook(){ + println("Title: "+title+" Author: " +author ) + } + +} \ No newline at end of file diff --git a/src/task2&3.kt b/src/task2&3.kt new file mode 100644 index 0000000..79e0307 --- /dev/null +++ b/src/task2&3.kt @@ -0,0 +1,18 @@ +fun main() { + + var newBook = Book2("Harry Potter", "Jk Rowing", 2000) + + newBook.printBook() + +} + + + +class Book2(var title:String,var author: String, var yearPublished:Int ){ + + + fun printBook(){ + println("Title: "+title+" Author: " +author ) + } + +} \ No newline at end of file