Latest Deals

Gradle - Fabricating Systems FP Handson Solutions

Disclaimer: The main motive to provide this solution is to help and support those who are unable to do these courses due to facing some issue and having a little bit lack of knowledge. All of the material and information contained on this website is for knowledge and education purposes only.

Try to understand these solutions and solve your Hands-On problems. (Not encourage copy and paste these solutions)

Gradle - Fabricating Systems FP Handson Solutions

Course Path: Mobility & Wearables/BUILD TOOLS/Gradle - Fabricating Systems


1.Try it out - Fibonacci Sequence
Welcome to Gradle program to generate Fibonacii series

File Name - build.gradle

def fib(n)
{
  int first_num = 1
  int second_num = 1
  if(n==1)
  println first_num
  else if(n==2)
  println first_num + " "+second_num
  else if (n > 2)
  {
    print first_num + " "+second_num
    int i = 3
    while(i<=n)
    {
      int z = first_num + second_num
      print " "+z
      first_num = second_num
      second_num = z
      i = i+1
    }
  }
}
task fibo(){
  doLast
  {
    int n = Integer.parseInt(num)
    println "First"+n+"fibonacci numbers:"
    fib n
  }
}




2.Try it out - Play with Dependencies
Welcome to Gradle program to define dependency tasks

File Name - build.gradle

project(':projectA'){
  task hello
}
task hello
println tasks.getByPath('taskA').path
println tasks.getByPath('independent task').path
println tasks.getByPath('taskB').path
println tasks.getByPath('dependent on taskA').path



3.Exercise to Build Java Project
Welcome to Gradle program to calculate area of circle and square

File Name - build.gradle

task circle {
  doLast {
    double area = (22/7)*Double.parseDouble(radius)*Double.parseDouble(radius)
    println 'area of circle is = '+area
  }
}
task square {
  doLast {
    double area = Double.parseDouble(side)*Double.parseDouble(side)
    println 'area of circle is = '+area
  }
}



Post a Comment

Any comments and suggestion will be appreciated.

Previous Post Next Post

Join Telegram Channel

Join Notes Bureau Lets Teach and Learn

Join Telegram Channel