diff --git a/Task part 1/.gitignore b/Task part 1/.gitignore new file mode 100644 index 0000000..3ddbf4c --- /dev/null +++ b/Task part 1/.gitignore @@ -0,0 +1,32 @@ +### IntelliJ IDEA ### +out/ +!**/src/main/**/out/ +!**/src/test/**/out/ + +### Kotlin ### +.kotlin + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache +bin/ +!**/src/main/**/bin/ +!**/src/test/**/bin/ + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/Task part 1/.idea/.gitignore b/Task part 1/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/Task part 1/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/Task part 1/.idea/inspectionProfiles/Project_Default.xml b/Task part 1/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..df543e3 --- /dev/null +++ b/Task part 1/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/Task part 1/.idea/kotlinc.xml b/Task part 1/.idea/kotlinc.xml new file mode 100644 index 0000000..cba7a76 --- /dev/null +++ b/Task part 1/.idea/kotlinc.xml @@ -0,0 +1,10 @@ + + + + + + + \ No newline at end of file diff --git a/Task part 1/.idea/libraries/KotlinJavaRuntime.xml b/Task part 1/.idea/libraries/KotlinJavaRuntime.xml new file mode 100644 index 0000000..3e6dc71 --- /dev/null +++ b/Task part 1/.idea/libraries/KotlinJavaRuntime.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Task part 1/.idea/misc.xml b/Task part 1/.idea/misc.xml new file mode 100644 index 0000000..f03c948 --- /dev/null +++ b/Task part 1/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Task part 1/.idea/modules.xml b/Task part 1/.idea/modules.xml new file mode 100644 index 0000000..91c01ea --- /dev/null +++ b/Task part 1/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/Task part 1/.idea/vcs.xml b/Task part 1/.idea/vcs.xml new file mode 100644 index 0000000..6c0b863 --- /dev/null +++ b/Task part 1/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Task part 1/Task part 1.iml b/Task part 1/Task part 1.iml new file mode 100644 index 0000000..43dd653 --- /dev/null +++ b/Task part 1/Task part 1.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Task part 1/src/Main.kt b/Task part 1/src/Main.kt new file mode 100644 index 0000000..aeb2a86 --- /dev/null +++ b/Task part 1/src/Main.kt @@ -0,0 +1,35 @@ + +// title after book = its a requirement (constructor +// it can be after Book or write constructor +class Book(var title: String, var author: String, var yearPublished: Int, var genre: String){ +// var title: String = "" +// var author: String = "" +// var yearPublished: Int = 2000 +// constructor(title: String, author: String, yearPublished: Int) +// fun info(){ +// println("title= $title, author: $author, Published: $yearPublished") +// } +fun getBookInfo(){ + println("$title : $genre by $author ($yearPublished)") +} +} +// name = primary constructor , accNum is a secondary constructor +class bankAcc(var name: String) { + constructor( accountNum: Int): this("") + fun printInfo(){ + println("Account Holder: $name") + } +} + + +fun main() { + var nbkAcc = bankAcc("Mishal") + nbkAcc.printInfo() + + var myBook = Book("Journey", "Mishal", 20205, "Drama") +// myBook.author = "Mishal" +// myBook.title = "Journey" +// myBook.yearPublished = 2025 +// myBook.info() + myBook.getBookInfo() +} \ No newline at end of file