-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathatv8.kt
36 lines (28 loc) · 1016 Bytes
/
atv8.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// Descrição: Programa que ativa ou desativa a tela de smartphones comuns e dobráveis.
open class Phone(open var isScreenLightOn: Boolean = false){
open fun switchOn() {
isScreenLightOn = true
}
open fun switchOff() {
isScreenLightOn = false
}
open fun checkPhoneScreenLight() {
val phoneScreenLight = if (isScreenLightOn) "on" else "off"
println("The phone screen's light is $phoneScreenLight.")
}
}
class FoldablePhone(override var isScreenLightOn: Boolean = false, var isPhoneFoldedUp: Boolean = false) : Phone(isScreenLightOn){
fun foldedUp(){
isPhoneFoldedUp = true
}
fun unfolded(){
isPhoneFoldedUp = false
}
override fun switchOn(){
isScreenLightOn = if (isPhoneFoldedUp) false else true
}
override fun checkPhoneScreenLight() {
val phoneScreenLight = if (isScreenLightOn) "on" else "off"
println("Sobrescrito The phone screen's light is $phoneScreenLight.")
}
}