Skip to content
Open
Show file tree
Hide file tree
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
32 changes: 32 additions & 0 deletions Task part 1/.gitignore
Original file line number Diff line number Diff line change
@@ -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
3 changes: 3 additions & 0 deletions Task part 1/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Task part 1/.idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions Task part 1/.idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions Task part 1/.idea/libraries/KotlinJavaRuntime.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Task part 1/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Task part 1/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Task part 1/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Task part 1/Task part 1.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/testResources" type="java-test-resource" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
</component>
</module>
35 changes: 35 additions & 0 deletions Task part 1/src/Main.kt
Original file line number Diff line number Diff line change
@@ -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()
}