Skip to content

created a calculator blank #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
31 changes: 31 additions & 0 deletions app/src/main/java/com/itis/androidlabproject/Calculator.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.itis.androidlabproject

import java.util.*

open class Calculator(
var expression: String
) {
private val Pi = 3.14
private val E = 2.71
private var expTree: TreeSet<Double>? = null

open fun calculate () {

}

private fun plus (a: Double, b: Double) : Double {
TODO()
}

private fun minus (a: Double, b: Double) : Double {
TODO()
}

private fun divide (a: Double, b: Double) : Double {
TODO()
}

private fun multiply (a: Double, b: Double) : Double {
TODO()
}
}
7 changes: 7 additions & 0 deletions app/src/main/java/com/itis/androidlabproject/Engineerable.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.itis.androidlabproject

interface Engineerable {
fun calcLog (a: Double, b: Double) : Double
fun sin(a: Double) : Double
fun cos(a: Double) : Double
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.itis.androidlabproject

class EngineeringCalculator (
expression: String
) : Calculator(expression), Engineerable {
override fun calculate () {

}

override fun calcLog(a: Double, b: Double): Double {
TODO("Not yet implemented")
}

override fun sin(a: Double): Double {
TODO("Not yet implemented")
}

override fun cos(a: Double): Double {
TODO("Not yet implemented")
}


}
5 changes: 5 additions & 0 deletions app/src/main/java/com/itis/androidlabproject/Graphable.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.itis.androidlabproject

interface Graphable {
fun buildGraph()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.itis.androidlabproject

class GraphingCalculator(
expression: String
) : Calculator(expression), Graphable {
override fun buildGraph() {
TODO("Not yet implemented")
}
}
8 changes: 7 additions & 1 deletion app/src/main/java/com/itis/androidlabproject/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,11 @@ class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

var simpleCalculator = Calculator("5.2+4")
var gCalculator = GraphingCalculator("y=5*x")
var engineeringCalculator = EngineeringCalculator("")

println(simpleCalculator.calculate())
}
}
}