Purchase Solution

Java Application: Printing a square using loop

Not what you're looking for?

Ask Custom Question

Write a java application that uses for loop, while loop, or do-while loop to print a square which has 10 X 10 lines of #, except lines 2, 4, and 6 which consist of * instead of # . Therefore the final output will look like this:

##########
**********
##########
**********
##########
**********
##########
##########
##########
##########

Purchase this Solution

Solution Summary

Solution uses nested for loops, and if-then-else statement to achieve the goal.

Solution Preview

Please rename the attached 525569-PrintSquare.java to PrintSquare.java before compiling.

You can use following instructions to compile and run the program at command prompt.

javac PrintSquare.java
java PrintSquare

Version 1.7.0_03 of Java was used in ...

Purchase this Solution


Free BrainMass Quizzes
C# variables and classes

This quiz contains questions about C# classes and variables.

Javscript Basics

Quiz on basics of javascript programming language.

Basic Computer Terms

We use many basic terms like bit, pixel in our usual conversations about computers. Are we aware of what these mean? This little quiz is an attempt towards discovering that.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.