Fixing changes
This commit is contained in:
parent
ce425b3087
commit
e21ecfa96c
5 changed files with 8 additions and 13 deletions
|
@ -1,5 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_launcher_name">Calculator_debug</string>
|
||||
<string name="scientific_name">Scientific_debug</string>
|
||||
</resources>
|
|
@ -28,7 +28,7 @@
|
|||
android:name=".activities.ScientificActivity"
|
||||
android:screenOrientation="portrait"
|
||||
android:parentActivityName=".activities.MainActivity"
|
||||
android:label="@string/scientific_name"/>
|
||||
android:label="@string/app_launcher_name"/>
|
||||
|
||||
<activity
|
||||
android:name=".activities.WidgetConfigureActivity"
|
||||
|
|
|
@ -10,13 +10,10 @@ import com.simplemobiletools.commons.extensions.*
|
|||
|
||||
class ScientificActivity : SimpleActivity() {
|
||||
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
override fun onCreate(savedInstanceState: Bundle?){
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.scientific_activity)
|
||||
appLaunched(BuildConfig.APPLICATION_ID)
|
||||
|
||||
updateViewColors(calculator_holder, config.textColor)
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,16 +3,15 @@ package com.simplemobiletools.calculator.operation
|
|||
import com.simplemobiletools.calculator.operation.base.Operation
|
||||
import com.simplemobiletools.calculator.operation.base.UnaryOperation
|
||||
|
||||
class ParOperation(value: Double) : UnaryOperation(value), Operation {
|
||||
class FactorialOperation(value: Double) : UnaryOperation(value), Operation {
|
||||
|
||||
override fun getResult(): Double {
|
||||
override fun getResult(): Double{
|
||||
var result = 1.0
|
||||
if (value==0.0 || value==1.0){
|
||||
return result
|
||||
} else {
|
||||
var base: Int = value.toInt()
|
||||
for (i in 1..base){
|
||||
//Find Factorial of a number using for loop
|
||||
}else{
|
||||
var base = value.toInt()
|
||||
for(i in 1..base){
|
||||
result *= i
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ object OperationFactory {
|
|||
PERCENT -> PercentOperation(baseValue, secondValue)
|
||||
POWER -> PowerOperation(baseValue, secondValue)
|
||||
ROOT -> RootOperation(baseValue)
|
||||
FACTORIAL -> ParOperation(baseValue)
|
||||
FACTORIAL -> FactorialOperation(baseValue)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue