Java Tutorial [#05] - First coding challenges

in programming •  7 years ago  (edited)

Header.jpg

Disclaimer!
If you find any mistakes in this post or you don't know what to do at a specific point? Feel free to write me a comment! 👍
Greets from Germany ✌️

Last Part Next part
<- #04 All Loops + more Math #05.5 First coding challenges -> Solutions ->

Do you got bored from all the reading last time? Now here is something more practical! Some coding challenges. You aren't supposed to do it in short amount of time. So take your time and make your code as small and logical as possible.

Here is the first challenge:
The Half pyramid. You can make it by using 2 for-Loops into each other.
Results should look like this:

Image 1.PNG

Now this is an easy one. Create with only 1 while-Loop this output:

Image 2.PNG

And at the end, the hardest challenge. Create a program that can calculate the radius of a sphere from the surface. (The correct formula for this is: Formular 1.png )

To use PI, you have to write Math.PI
To use square root, you have to write Math.sqrt(input)

Image 3.PNG

To bring this one step further, make a custom error message, if the value of o is too small (Smaller or equal 0.0):

Image 4.PNG

Here are the solutions for these challenges

Support this project by upvote this post and commenting ^^ (and resteem)

Last Part Next part
<- #04 All Loops + more Math #05.5 First coding challenges -> Solutions ->

Remember: I'm not a genius too! I'm 16 years old but I know quite a lot, because Java or programming in general is fascinating me so much (and yes I have friends and other hobbies :)). So don't give up! Follow you dreams and in some day, they will get true.
Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!