# Programming Exercises

1. Print 28 stars in a line.

2. Create a String and print it with spaces between its characters. Print it in
reversed

order.

3. Create an array of integers and display the largest and the smallest values.

a) Consider that all the numbers are positive.

b) Consider that the numbers may be positive or negative.

4. Print a rectangle of stars:

**********

**********

**********

**********

**********

5. Print this triangles of stars:

*

**

***

****

*****

****

***

**

*

6. Print 4 slightly larger triangles.

7. Define a class Matrix that can store an n * m matrix of
int numbers and supports

operations such as printing, adding, subtracting matrices and setting and
getting

values.

8. Define a SymMatrix that does the same things for a symmetric matrix (the

diagonal is the line of symmetry). Save space by storing only half of the
matrix.

**Homework
Due:**

Monday, March 1, 6:10pm

**Format:**

Hard (paper) copies submitted in class; do not upload the solutions on your websites until

you are told to do so !

**Note**:

This is an individual assignment !

**Grading:**

This is a graded assignment/homework. Grades are assigned in a cumulative fashion (i.e.

for an A you need to have completed the requirements for a B+ before doing ex. 4.33; if,

for example, you do all the exercises apart from 4.30, you get a C.).

**Requirements**(the exercises are all from the book, at page 102):

D C C+ B B+ A |
- - - - - - |
4.28 4.29 4.30 4.31 4.32 4.33 |