Java Programs

profilemaak
c110-02-27assignments.pdf

Assignments

Equilateral Triangle

• Write a program to generate an ASCII-graphics of an equilateral triangle. The input to your program is a single integer number representing the length of the side of the triangle. This number must be 2 or larger.

Example

• Welcome to the equilateral triangle drawing program. Enter the length of the side: 4 Draw:

* * * * * * * * * *

Simple Text Formatter

• Write a simple text formatter. Your program will read ONE line of text and print it out in ONE OR MORE lines.

• The text on the output line(s) should be formatted over a user-specified line WIDTH. There are three possible formatted output for an input line. These are the LEFT-JUSTIFIED, RIGHT-JUSTIFIED, and CENTERED versions.

Eight Queen Problem

• Write a program that allows the user to interactively place 8 queen pieces on a chessboard.