> Gradle - Fabricating Systems Hacker-rank Hands-On Solutions - TECH UPDATE

Gradle - Fabricating Systems Hacker-rank Hands-On Solutions

 Gradle - Fabricating Systems Hacker rank Hands-On Solutions

The main agenda of these solution is those who are unable to do this course due to facing some issues, a little bit of lack of knowledge on these hands-on questions. Try to understand these codes and solve your hands-On Problems. (Not encourage copy and paste these solutions)

The Course Id is 55935.

1. Gradle program to generate Fibonacci Series



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. Gradle program to define dependency tasks



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. Gradle program to calculate area of circle and square



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
  }
}
Gradle - Fabricating Systems Hacker-rank Hands-On Solutions Gradle - Fabricating Systems Hacker-rank Hands-On Solutions Reviewed by TECH UPDATE on January 24, 2022 Rating: 5

8 comments:

  1. Can you please provide the hands-on for R basics, course id 55101

    ReplyDelete
  2. Hey guys, the Gradle program to define dependency tasks solution isn't working for me. What could be wrong? Please help!

    ReplyDelete
  3. The test case of Program with gradle dependency tasks is not working. Anyone has any other code

    ReplyDelete
  4. 2. Gradle program to define dependency tasks - DOESNT WORK. it keeps failing

    ReplyDelete
  5. Bro gradle 2nd handson test cases failed

    ReplyDelete
  6. In Gradle program to define dependency tasks : I'm getting an error as ProjectA not found what should I need to change can you please help me

    ReplyDelete
  7. Gradle program to define dependency tasks Correct Code
    task taskA {
    doLast {
    println "independent task"
    }
    }

    task taskB {
    dependsOn taskA
    doLast {
    println "dependent on taskA"
    }
    }

    ReplyDelete
  8. Gradle program to define dependency tasks Correct Code

    ReplyDelete

Powered by Blogger.