kotlin圆角矩形封装
Formula to find area of Rectangle: area = length*width
查找矩形面积的公式: 面积=长*宽
Given the value of length and width, we have to find the area of Rectangle.
给定长度和宽度的值,我们必须找到矩形的面积。
Example:
例:
Input:
length = 2.6
width = 3.2
Output:
area = 8.32
在Kotlin查找矩形区域的程序 (Program to find area of Rectangle in Kotlin)
package com.includehelp
import java.util.*
//Main Function , Entry point of Program
fun main(args: Array<String>) {
//Input Stream
val scanner = Scanner(System.`in`)
//Input Length of Rectangle
print("Enter Rectangle Length : ")
val length = scanner.nextDouble()
//Input Width of Rectangle
print("Enter Rectangle Width : ")
val width = scanner.nextDouble()
//Calculate Area of Rectangle
val rectangleArea = length * width
//Print Area
println("Area of Rectangle is :$rectangleArea")
}
Output
输出量
Run 1:
Enter Rectangle Length : 2.6
Enter Rectangle Width : 3.2
Area of Rectangle is :8.32
---
Run 2:
Enter Rectangle Length : 6
Enter Rectangle Width : 8
Area of Rectangle is :48.0
翻译自: https://www.includehelp.com/kotlin/find-area-of-rectangle.aspx
kotlin圆角矩形封装