Kotlin Challenges
This repository contains a set of Kotlin coding challenges together with the solutions. Kotlin Challenges Part 1 is here
Challenge Questions: All of the challenges are listed below.
Solutions: The links to solutions are provided below the questions.
CHALLENGES:
1. Calculate Weight on Different Planets 🌏 Use the link below to help you calculate your weight on different planets and convert each planet weight to a double, formatting to two decimal places. link
2. Senselessness S Count Count the number of times the letter ‘s’ appears in the word senselessness. Describe the rules for the count function by providing an anonymous function as an argument.
3. Anonymous Greeting Function Define an anonymous function within the main function, call it, and print the result. The anonymous function should define a variable and return a greeting message string.
4. Assign Anonymous Greeting to a Variable First complete the challenge above(AnonymousGreetingFunction). Then using Function Type, assign the anonymous greeting function to a variable.
5. Add guest to Anonymous Greeting Function First complete the two challenges above (AnonymousGreetingFunction and AssignAnonymousGreetingFunctionToVariable). Then add a guest2 who will be greeted with the original guest.
6Volume of a Box Create an object with width, height and length values and create a function that gets the object arguments and prints the volume of the box.
7. Use Lambda to Square Number Create a lambda that produces the square of a number.
8. Calculate a Grade using a Lambda Calculate a grade using a lambda.
9. Missing Angle Create a function that classifies the missing angle as either “acute”, “right” or “obtuse” based on its degrees. Provide two numbers as arguments and calculate the missing degree by adding the two numbers and subtracting that from 180.
10.Number Limit Write a function which takes three number arguments (one number as an input and the other two numbers representing the lowest and highest points of the range). If the number falls within the range, print the number. If the number is less than the lower limit of the range, print the lowest limit number and if the number is greater than the upper limit of the range, print the highest number.