|
| 1 | +/** |
| 2 | + * Java Printing Exercises for Beginners |
| 3 | + * |
| 4 | + * This file contains 10 exercises for practicing basic printing in Java. |
| 5 | + * Complete each exercise in a separate file with the appropriate class name. |
| 6 | + * These exercises only use println() and print() - no variables or other concepts. |
| 7 | + */ |
| 8 | + |
| 9 | +/* |
| 10 | + |
| 11 | +Exercise 1: Basic Hello World |
| 12 | +--------------------------- |
| 13 | +Create a Java program that displays the message "Hello, World!" on the screen. |
| 14 | +Class name should be: HelloWorld |
| 15 | + |
| 16 | +Exercise 2: Personal Introduction |
| 17 | +--------------------------- |
| 18 | +Create a program that displays your name and two facts about yourself, each on separate lines. |
| 19 | +Class name should be: Introduction |
| 20 | + |
| 21 | +Exercise 3: Print vs Println |
| 22 | +--------------------------- |
| 23 | +Write a program that demonstrates the difference between print() and println() by: |
| 24 | +1. Using print() to put two phrases on the same line |
| 25 | +2. Using println() to move to a new line |
| 26 | +3. Adding two more lines with println() |
| 27 | +Class name should be: PrintVsPrintln |
| 28 | + |
| 29 | +Exercise 4: Triangle Pattern |
| 30 | +--------------------------- |
| 31 | +Create a program that draws a simple triangle pattern using asterisks (*) like this: |
| 32 | + * |
| 33 | + *** |
| 34 | + ***** |
| 35 | + ******* |
| 36 | +********* |
| 37 | +Class name should be: Triangle |
| 38 | + |
| 39 | +Exercise 5: Special Characters |
| 40 | +--------------------------- |
| 41 | +Write a program that shows how to print the following special characters: |
| 42 | +1. Quotation marks (") |
| 43 | +2. Backslash (\) |
| 44 | +3. A new line within a single println statement |
| 45 | +4. A tab character within a line |
| 46 | +Class name should be: SpecialCharacters |
| 47 | + |
| 48 | +Exercise 6: Menu Display |
| 49 | +--------------------------- |
| 50 | +Create a program that displays a formatted menu with at least 4 options, surrounded |
| 51 | +by a border made of special characters. |
| 52 | +Class name should be: MenuDisplay |
| 53 | + |
| 54 | +Exercise 7: ASCII Art |
| 55 | +--------------------------- |
| 56 | +Create a program that draws a simple face or picture using ASCII characters. |
| 57 | +Be creative with your design! |
| 58 | +Class name should be: ASCIIFace |
| 59 | + |
| 60 | +Exercise 8: Name Box |
| 61 | +--------------------------- |
| 62 | +Write a program that displays your name (or "STUDENT") in a decorated box. |
| 63 | +Class name should be: NameBox |
| 64 | + |
| 65 | +Exercise 9: Text Animation |
| 66 | +--------------------------- |
| 67 | +Create a program that displays a simple "loading" animation by showing |
| 68 | +different frames one after another (each frame is just a println statement). |
| 69 | +Class name should be: TextAnimation |
| 70 | + |
| 71 | +Exercise 10: Pattern Creation |
| 72 | +--------------------------- |
| 73 | +Create a program that displays a checkerboard or other repeated pattern. |
| 74 | +Class name should be: Checkerboard |
| 75 | +*/ |
| 76 | + |
| 77 | +// Instructions for students: |
| 78 | +// 1. Read each exercise carefully |
| 79 | +// 2. Create a new Java file for each exercise with the specified class name |
| 80 | +// 3. Write code using only System.out.println() and System.out.print() |
| 81 | +// 4. Make sure your output matches the exercise description |
| 82 | +// 5. Save, compile, and run your program to check that it works correctly |
| 83 | + |
0 commit comments