Explore the topics covered in the Geometric shapes lesson and enhance your programming skills by completing the included programming exercises.

Practice exercises

1

Square

Write a program in Java that asks for a number (x) and a width to show a square of that width.

2

Rectangle

Write a program in Java that requests a number x and then displays a rectangle 3 columns wide and 5 rows high using that digit.

3

Triangle Rectangle

Write a program in Java that asks for a symbol and a width to paint a triangle of that width and height using that number to draw it.

4

Draw a hollow square

Write a program in Java that asks the user for a symbol and a width. You will use these to draw a hollow square of the given width and height.

5

Draw a hollow rectangle

Write a program in Java that asks the user for a symbol, a width and a height to draw a hollow rectangle with those dimensions.

6

Draw a parallelogram

Create a Java program to draw a parallelogram, with the width, height and character requested from the user.

7

Triangle Rectangle String

Write a program in Java that asks the user for a string and displays a right-aligned triangle.

8

Triangle Rectangle Mirror

Write a Java program similar to the triangle rectangle exercise. In this exercise, ask the user for two integers, the first is an integer x that is used to draw the area of ​​the right triangle on the screen.

9

Draw a pyramid

Create a Java program that asks the user for text and draws a pyramid on the screen.

10

Graphic of a Function

Create a program Java to draw the graphic of the function y=(x-4)² for a range of integer values of x requested from the user.

Java Course Lessons

Discover all the lessons included in the Java programming course. Complete all the exercises and learn to program by programming.

Social networks

Help us to share free knowledge and programming in the world.

Keep learning

C# Programming Course

Free programming course with practical exercises and solutions in C#. Start learning right now!

Exercises C# App

Take your Exercises C# lessons everywhere with our Android app. Download it now from Google Play