RashedBQ

Average Salarys

Jul 12th, 2021 (edited)
82
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.     var names =Array<String>(10){""}
  3.     var sallary =Array<Double>(10){0.0}
  4.     var No =0
  5.     var sum = 0.0
  6.  
  7.  
  8.     for (i in 0 until names.size)
  9.     {
  10.         println("Enter employee name No "+(No+1))
  11.         names[i] = readLine()!!.toString()
  12.  
  13.         println("Enter employee salary No "+(No+1))
  14.         sallary[i]= readLine()!!.toDouble()
  15.         sum+=sallary[i]
  16.         No++
  17.  
  18.     }
  19. //    for (i in 0 until  names.size) {
  20. //        println("Name " + names[i]+" | "+"Sallary "+sallary[i])
  21. //        println("---------------------|-----------------------")
  22. //    }
  23.  
  24.     var avg = sum / names.size
  25.     println("---------------------#-----------------------")
  26.     for (i in 0 until names.size) {
  27.         if (avg > sallary[i])
  28.             println("Name " + names[i]+" | "+"Sallary "+sallary[i]+" +")
  29.             else println("Name " + names[i]+" | "+"Sallary "+sallary[i]+" -")
  30.         println("---------------------|-----------------------")
  31.     }
  32.     println("---------------------#-----------------------")
  33. //    println(sum)
  34.  
  35.  
  36.  
  37.  
RAW Paste Data Copied