Discount week - October
Save up to 80 % on our C and C++ e-learning courses. Only this week!
Get up to 50 % extra points for free! More info

Solved tasks for Java lessons 1-3

The following exercises will help you put your knowledge of Java to the test. Based off of what you've learned from previous lessons. Try to solve them on your own, but know that you could always download the working solutions under the article. Nonetheless, beware that when you view the solution without solving the exercise, you won't learn anything :)

If you find yourself stuck at some point, you should always try going back to check previous tutorials first and figure the problem out by yourself.

Easy exercise

Create an application which will ask for a username and then for his/her ability. Then the program will print "name is ability", see image below.

The application screen sample:

Console application
Hi, what is your name?
Bill Gates
What are you like?
ultraepic rich
Bill Gates is ultraepic rich

Intermediate exercise

Create an application which will ask for an integer and prints its second power (x squared).

The application screen sample:

Console application
Enter a number, and I'll square it:
64
Result: 4096

Advanced exercise

Create an application that will ask for a circle's radius. Then print its circumference and its area.

The application screen sample:

Console application
Enter the circle's radius (cm):
12.1
The circle's circumference based on the given radius is: 75.98801 cm
Area of the circle is: 459.7275 cm^2

 

Download

Downloaded 23x (49.56 kB)
Application includes source codes in language Java

 

Previous article
Variables, type system and parsing in Java
All articles in this section
Java Basic Constructs
Article has been written for you by David Capka
Avatar
Do you like this article?
3 votes
The author is a programmer, who likes web technologies and being the lead/chief article writer at ICT.social. He shares his knowledge with the community and is always looking to improve. He believes that anyone can do what they set their mind to.
Unicorn university The author learned IT at the Unicorn University - a prestigious college providing education on IT and economics.
Activities (4)

 

 

Comments

Avatar
Erëka Covet :8/10/2018 4:12

Thanks !

 
Reply
8/10/2018 4:12
To maintain the quality of discussion, we only allow registered members to comment. Sign in. If you're new, Sign up, it's free.

1 messages from 1 displayed.