Exercises - chapter 1

Mr. Gottsacker
Computer Programming


1.101

Write a program that displays the following sentences. Each sentence should be printed on its own line.

                
Welcome to Java.
Welcome to Computer Science.
Programming is fun!
                
                

1.102

Write a program that prints out a poem. It can be an original piece, or you can find one online. The first line should display the poem’s title, and the second line should display the author. If you find one online, include a link to the poem in the comments of the code. No length requirement.


1.103

Write a program that displays ASCII art. You can head to a site like http://ascii.co.uk/art/ and get an example there. There are some simple ones at http://ascii.co.uk/art/small. Be sure to give credit in your code comments if you use another person’s work. Or, make your own ASCII art!

Note: Avoid art pieces that contain a backslash (the \ character). They add some complexity here and will throw errors if not escaped properly.


1.104

Write a program that displays the following table:

                
a	a^2	a^3 
1	1	1   
2	4	8   
3	9	27  
4	16	64
                
                

1.105

Write a program that displays the result of \(9.5 * 4.5 - 2.5 * 3 \over 45.5 - 3.5\)