This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.alexaleluia12; | |
import java.time.Duration; | |
import java.time.LocalTime; | |
import java.util.Objects; | |
import java.util.stream.Stream; | |
public class PocDesempenho { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PentagoShape : Shape { | |
override fun createOutline( | |
size: Size, | |
layoutDirection: LayoutDirection, | |
density: Density | |
): Outline { | |
return Outline.Generic( | |
path = mycustonDraw(size = size) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from contextlib import closing | |
import sqlite3 | |
# db from - https://github.com/google-developer-training/basic-android-kotlin-compose-training-bus-schedule-app/blob/main/app/src/main/assets/database/bus_schedule.db | |
# source - https://www.digitalocean.com/community/tutorials/how-to-use-the-sqlite3-module-in-python-3 | |
with closing(sqlite3.connect("bus_schedule.db")) as connection: | |
with closing(connection.cursor()) as cursor: | |
rows = cursor.execute("SELECT * FROM Schedule").fetchall() | |
print(rows) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
val winningBid = Bid(5000, "Private Collector") | |
println("Item A is sold at ${auctionPrice(winningBid, 2000)}.") | |
println("Item B is sold at ${auctionPrice(null, 3000)}.") | |
} | |
class Bid(val amount: Int, val bidder: String) | |
fun auctionPrice(bid: Bid?, minimumPrice: Int): Int { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
val xaiomi = Foldable(isFolded=true, isScreenLightOn=false) | |
xaiomi.checkPhoneScreenLight() | |
xaiomi.switchOn() | |
xaiomi.checkPhoneScreenLight() | |
xaiomi.isFolded = false | |
xaiomi.switchOn() | |
xaiomi.checkPhoneScreenLight() | |
} | |
open class Phone(var isScreenLightOn: Boolean = false){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
val amanda = Person("Amanda", 33, "play tennis", null) | |
val atiqah = Person("Atiqah", 28, "climb", amanda) | |
amanda.showProfile() | |
atiqah.showProfile() | |
} | |
class Person(val name: String, val age: Int, val hobby: String?, val referrer: Person?) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
val s1 = Song("Viva la vida", "One peace", 2010, 90) | |
val s2 = Song("Nego Drama", "Racionais", 2002, 5000) | |
println("s1 " + s1.isPopular) | |
println("s2 "+ s2.isPopular) | |
println() | |
s1.printDescription() | |
s2.printDescription() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
printFinalTemperature(27.0, "celcius", "farenhit", celciusToFarenhit) | |
printFinalTemperature(350.0, "kelving", "celcius") {it - 273.15} | |
printFinalTemperature(10.0, "farenhit", "kelvin", farenhitToKelvin) | |
} | |
val celciusToFarenhit = { | |
celcius: Double -> | |
(9.0/5.0*celcius) + 32.0 | |
} | |
val farenhitToKelvin = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
val child = 5 | |
val adult = 28 | |
val senior = 87 | |
val isMonday = true | |
println("The movie ticket price for a person aged $child is \$${ticketPrice(child, isMonday)}.") | |
println("The movie ticket price for a person aged $adult is \$${ticketPrice(adult, isMonday)}.") | |
println("The movie ticket price for a person aged $senior is \$${ticketPrice(senior, isMonday)}.") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() { | |
val morningNotification = 51 | |
val eveningNotification = 135 | |
printNotificationSummary(morningNotification) | |
printNotificationSummary(eveningNotification) | |
} | |
fun printNotificationSummary(numberOfMessages: Int) { |
NewerOlder