Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fun main() {
- val firstNumber = 10
- val secondNumber = 5
- val thirdNumber = 8
- val result = add(firstNumber, secondNumber)
- val anotherResult = add(firstNumber, thirdNumber)
- println("$firstNumber - $secondNumber = $result")
- println("$firstNumber - $thirdNumber = $anotherResult")
- }
- fun add(firstNum: Int, secondNum: Int): Int {
- return firstNum - secondNum
- }
- fun main() {
- val operatingSystem = "ChromeOS"
- val mess = displayAlertMessage(operatingSystem, emailId)
- println(mess)
- }
- // Define your displayAlertMessage() below this line.
- fun displayAlertMessage(os: String, ei: String): String {
- val message = "There's a new sign-in request on $os for your Google Account $ei."
- return message
- }
- fun main() {
- val operatingSystem = "ChromeOS"
- val mess = displayAlertMessage(os= operatingSystem,ei = firstUserEmailId)
- // The following line of code assumes that you named your parameter as emailId.
- // If you named it differently, feel free to update the name.
- println(mess)
- val secondUserOperatingSystem = "Windows"
- val mess2 = displayAlertMessage(secondUserOperatingSystem, secondUserEmailId)
- println(mess2)
- val thirdUserOperatingSystem = "Mac OS"
- val mess3 = displayAlertMessage(thirdUserOperatingSystem, thirdUserEmailId)
- println(mess3)
- }
- fun displayAlertMessage(os: String, ei: String): String {
- val message = "There's a new sign-in request on $os for your Google Account $ei."
- return message
- }
- fun main() {
- val Steps = 4000
- val caloriesBurned = pedometerStepsToCalories(Steps);
- println("Walking $Steps steps burns $caloriesBurned calories")
- }
- fun pedometerStepsToCalories(numberOfSteps: Int): Double {
- val caloriesBurnedForEachStep = 0.04
- val totalCaloriesBurned = numberOfSteps * caloriesBurnedForEachStep
- return totalCaloriesBurned
- }
- fun main() {
- val timeSpentToday = 200
- val timeSpentYesterday = 220
- val comparison = screenTime(timeSpentToday,timeSpentYesterday)
- println(comparison)
- }
- fun screenTime(timeSpentToday: Int, timeSpentYesterday: Int): Boolean {
- return timeSpentToday > timeSpentYesterday
- }
- fun main() {
- // println("City: Ankara")
- // println("Low temperature: 27, High temperature: 31")
- // println("Chance of rain: 82%")
- // println()
- // println("City: Tokyo")
- // println("Low temperature: 32, High temperature: 36")
- // println("Chance of rain: 10%")
- // println()
- // println("City: Cape Town")
- // println("Low temperature: 59, High temperature: 64")
- // println("Chance of rain: 2%")
- // println()
- // println("City: Guatemala City")
- // println("Low temperature: 50, High temperature: 55")
- // println("Chance of rain: 7%")
- // println()
- val city = "Guatemala City"
- val lowTemp = 50
- val highTemp = 55
- val chance = 7
- val disp = displayWeather(city,lowTemp,highTemp,chance)
- println(disp)
- }
- fun displayWeather(city: String, lowTemp: Int, highTemp: Int, chance: Int): String{
- val c = "City: $city"
- val temp = "Low temperature: $lowTemp, High temperature: $highTemp"
- val ca = "Chance of rain: $chance%"
- return "$c\n$temp\n$ca"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement