If you’ve ever tried to teach yourself programming and couldn’t quite
get going, then these assignments are for you. Refined over fifteen years,
these are the assignments I have used to teach the basics of Java to
nearly 2,000 ordinary public school students over my career.

If you have any questions about these assignments, please read the
Frequently-Asked Questions at the bottom of this page.

  Basics and Printing – 9 assignments, 58 points 0 Basics and Printing Installing the Java Development Kit (JDK) 20 points 1 Basics and Printing Compiler Check 3 points 2 Basics and Printing Compiling Practice  - code provided 3 points 3 Basics and Printing An Important Message  - code provided 5 points 4 Basics and Printing A Good First Program  - code providedby Zed Shaw 4 points 5 Basics and Printing Comments and Slashes  - code providedby Zed Shaw 3 points 6 Basics and Printing A Letter to Yourself 7 points 7 Basics and Printing Your Initials 6 points 8 Basics and Printing Numbers and Math  - code providedby Zed Shaw 7 points   Variables – 5 assignments, 48 points 9 Variables Variables and Names  - code providedby Zed Shaw 7 points 10 Variables More Variables and Printing  - code providedby Zed Shaw 7 points 11 Variables Using Variables 9 points 12 Variables Still Using Variables 10 points 13 Variables Your Schedule 15 points   Keyboard Input – 7 assignments, 106 points 14 Keyboard Input Asking Questions  - code providedby Zed Shaw 10 points 15 Keyboard Input The Forgetful Machine 12 points 16 Keyboard Input Name, Age, and Salary 15 points 17 Keyboard Input More User Input of Data 16 points 18 Keyboard Input Age in Five Years 18 points 19 Keyboard Input A Dumb Calculator 20 points 20 Keyboard Input BMI Calculator 15-28 points   If Statements – 17 assignments, 505 points 21 If Statements What If  - code providedby Zed Shaw 15 points 22 If Statements How Old Are You? 25 points 23 If Statements Else And If  - code providedby Zed Shaw 20 points 24 If Statements Weekday Name  - code provided 15 points 25 If Statements How Old Are You, Specifically? 20 points 26 If Statements Space Boxing 30 points 27 If Statements A Little Quiz 40 points 28 If Statements Modulus Animation  - code provided 20 points   GUIs – 3 assignments, 55 points 29 GUIs Using Swing for Input  - code provided 25 points 30 GUIs A Boring Window  - code provided 10 points 31 GUIs A Frame with a Panel with Writing on It  - code provided 20 points 32 If Statements Twenty Questions… well, actually just Two 35 points 33 If Statements Choose Your Own Short Adventure! 60 points 34 If Statements Age Messages 3 25 points 35 If Statements Two More Questions 35 points 36 If Statements BMI Categories 35-45 points 37 If Statements Gender Game 50 points 38 If Statements compareTo() Challenge 35 points 39 If Statements Alphabetical Order 30 points 40 If Statements The Worst Number-Guessing Game Ever 15 points   Random Numbers – 8 assignments, 160 points 41 Random Numbers Randomness  - code provided 15 points 42 Random Numbers Magic 8-Ball™  - code provided 10 points 43 Random Numbers A Number-Guessing Game 20 points 44 Random Numbers Fortune Cookie 15-25 points 45 Random Numbers Dice 25 points 46 Random Numbers One Shot Hi-Lo 35 points 47 Random Numbers Three-Card Monte 20 points   While Loops – 12 assignments, 500 points 48 While Loops Enter Your PIN  - code provided 15 points 49 While Loops Keep Guessing 50 points 50 While Loops Dice Doubles 45 points 51 While Loops Counting with a While Loop  - code provided 30 points 52 While Loops PIN Lockout  - code provided 10 points 53 While Loops Number-Guessing with a Counter 40 points 54 While Loops Hi-Lo with Limited Tries 55 points 55 While Loops Adding Values in a Loop 30 points   Do-While Loops – 5 assignments, 130 points 56 Do-While Loops Do-While Swimming  - code provided 15 points 57 Do-While Loops Flip Again?  - code provided 20 points 58 Do-While Loops Shorter Double Dice 40 points 59 Do-While Loops Again with the Number-Guessing 35 points 60 While Loops Safe Square Root 55 points 61 While Loops Right Triangle Checker 65 points 62 While Loops Collatz Sequence 30-60 points 63 While Loops Short Adventure 2: With a Loop 75 points 63b While Loops [New!]Baby Nim 60 points 63c While Loops [New!]Nim 70-185 points   For Loops – 14 assignments, 335 points 64 For Loops Counting with a For Loop  - code provided 10 points 65 For Loops Ten Times 15 points 66 For Loops Counting Machine 20 points 67 For Loops Counting Machine Revisited 25 points 68 For Loops Counting by Halves 20 points 69 For Loops Xs and Ys 15 points 70 For Loops Noticing Even Numbers 30 points 71 For Loops Fizz Buzz 40 points 72 For Loops Letter at a Time  - code provided 20 points 73 For Loops For Loop Challenge 40 points 74 For Loops Adding Values with a For Loop 30 points 75 Random Numbers Baby Blackjack 20 points   Projects – 5 assignments, 860 points 76 Projects Project: Blackjack 80-200 points   Graphics – 31 assignments, 1441 points 77 Graphics Graphics Demo 1: Basics  - code provided 20 points 78 Graphics Graphics Demo 2: Arcs and Custom Colors  - code provided 20 points 79 Graphics Graphics Demo 3: Fonts and Lines  - code provided 15 points 80 Graphics A Circle 20 points 81< /td>

Graphics A Smiling Face 40 points 82 Graphics A Clock Face 50-70 points 83 Graphics Graphing Lines  - code provided 40 points 84 Graphics Graphing Parabolas  - code provided 40 points 85 Graphics Graphics Demo 4: Polygons  - code provided 40 points 86 Graphics Drawing a Boring Triangle 30 points 87 Graphics Drawing Random Triangles 60 points 88 Graphics Drawing Random Right Triangles 80-140 points 89 Graphics Sierpinski Triangle 150 points 90 Graphics Boxy 1  - code provided 50 points 91 Graphics Boxy 2  - code provided 40 points 92 Graphics Boxy 3  - code provided 60 points 93 Graphics Smiling Face Function  - code provided 80 points 94 Graphics Forest and Trees  - code provided 150 points 95 Graphics Image Demo – Showing Images on the Screen  - code provided 20 points 96 Graphics Motivational Poster 50-80 points   Functions – 17 assignments, 1070 points 98 Functions Flicker Phrase  - code provided 15 points 99 Functions Heron’s Formula  - code provided 15 points 100 Functions Distance Formula  - code provided 50 points 101 Functions Month Name 60 points 102 Functions Month Offset 60 points 103 Functions Weekday Calculator 90 points 104 Functions Area Calculator 110 points 105 Functions Function Call Alphabet 90 points 106 Functions Fill-In Functions 100 points 107 Functions More Fill-In Functions 100 points 108 Functions Keychains for Saleby Aaron Gadberry 40 points 109 Functions Keychains for Sale, for real this timeby Aaron Gadberry 65 points 110 Functions Keychains for Sale, real ultimate powerby Aaron Gadberry 80 points 111 Functions Calling Functions from Other Files 40 points 112 Functions Evenness Function 60 points 114 Do-While Loops Baby Calculator  - code provided 20 points 115 Projects Project: Calculator 80-300 points 116 For Loops A Refresher 20 points 117 For Loops Refresher Challenge 20 points 118 For Loops Displaying Some Multiples 30 points   Nested Loops – 9 assignments, 580 points 119 Nested Loops Nesting Loops  - code provided 20 points 120 Nested Loops Odometer Loops  - code provided 25 points 121 Nested Loops Basic Nested Loops 50 points 122 Nested Loops Multiplication Table 65 points 123 Nested Loops Number Puzzle I 60 points 124 Nested Loops Getting Individual Digits 80 points 125 Nested Loops More Number Puzzles 100 points 126 Nested Loops Number Puzzles III: Armstrong Numbers 90 points 127 Nested Loops Number Puzzles IV: A New Hope 90 points   File Input and Output – 10 assignments, 535 points 128 File Input and Output Letter Revisited 40 points 129 File Input and Output High Score 50 points 130 File Input and Output Simple File Input 40 points 131 File Input and Output Summing Three Numbers from a File 50 points 132 File Input and Output Summing Three Numbers from Any File 65 points 133 File Input and Output Displaying a File 60 points 134 File Input and Output Summing Several Numbers from Any File 60 points 135 File Input and Output Simple Web Input  - code provided 15 points 136 File Input and Output A Little Puzzle 75 points 137 File Input and Output Vowel Capitalization 80 points   Arrays – 16 assignments, 1245 points 138 Arrays Basic Arrays 0 20 points 139 Arrays Basic Arrays 1 30 points 140 Arrays Basic Arrays 2 40 points 141 Arrays Basic Arrays 3 25 points 142 Arrays Copying Arrays 55 points 143 Arrays Grades in an Array and a File 90 points 144 Arrays Finding a Value in an Array 80 points 145 Arrays How Many Times? 40 points 146 Arrays Is It There or Not? 85 points 147 Arrays Where Is It? 90 points 148 Arrays Finding the Largest Value in an Array 100 points 149 Arrays Locating the Largest Value in an Array 110 points 150 Arrays Giving an Array a Bunch of Values at Once  - code provided 30 points 151 Arrays Parallel Arrays 100 points 152 Arrays Tic-Tac-Toe  - code provided 150 points 153 Arrays Hangman 200 points   Sorting – 11 assignments, 1000 points 154 Sorting MadLib Random  - code provided 40 points 155 Sorting Movie Title Generator  - code provided 40 points 156 Sorting PokéSwap  - code provided 40 points 157 Sorting PokéTrader  - code provided 30 points 158 Sorting PokéTrader 2  - code provided 20 points 159 Sorting Sorting an Array  - code provided 100 points 160 Sorting Exchange Sort  - code provided 120 points 161 Sorting Bubble Sort  - code provided 130 points 162 Sorting Selection Sort  - code provided 130 points   Records – 11 assignments, 1070 points 163 Records Web Addresses  - code provided 30 points 164 Records Web Addresses Array  - code provided 10 points 165 Records Address toString()  - code provided 20 points 166 Records Basic Records 80 points 167 Records A Little Database 100 points 168 Records A Little Database is shorter with a loop 100 points 169 Records Getting Data from a File 120 points

170 Records Getting More Data from a File 140 points 171 Records Storing Data in a File 150 points 172 Records Reading What You Wrote 160 points 173 Records Sorting an Array of Records 160 points 174 Sorting Sorting Strings 150 points 175 Sorting Sorting Records on Two Fields 200 points   Objects – 1 assignment, 100 points 176 Objects A Tic-Tac-Toe Class  - code provided 100 points   ArrayLists – 14 assignments, 1165 points 177 ArrayLists Basic ArrayLists 0 20 points 178 ArrayLists Basic ArrayLists 1 30 points 179 ArrayLists Basic ArrayLists 2 40 points 180 ArrayLists Basic ArrayLists 3 25 points 181 ArrayLists Copying ArrayLists 55 points 182 ArrayLists Finding a Value in an ArrayList 80 points 183 ArrayLists ArrayList – There or Not? 85 points 184 ArrayLists ArrayList – Where Is It? 90 points 185 ArrayLists Getting the Largest Value in an ArrayList 100 points 186 ArrayLists Locating the Largest Value in an ArrayList 110 points 187 ArrayLists Sorting an ArrayList 120 points 188 ArrayLists Sorting an ArrayList of Strings 150 points 189 ArrayLists Sorting Sentences 100 points 190 ArrayLists Sorting an ArrayList of Records 160 points 191 Projects Project: Address Book 200-400 points 192 Projects Project: Hearts 300-500 points   Project Euler – 20 assignments, 1715 points 193 Project Euler Project Euler 001 – Sum Multiples of 3 or 5 20 points 194 Project Euler Project Euler 002 – Sum Even Fibonacci Numbers 40 points 195 Project Euler Project Euler 003 – Largest Prime Factor of Big Number 60 points 196 Project Euler Project Euler 004 – Largest Palindromic Product 70 points 197 Project Euler Project Euler 005 – Smallest Divisible by 1-20 50 points 198 Project Euler Project Euler 006 – Sums of Squares Minus Squares of Sums 50 points 199 Project Euler Project Euler 007 – The 10001st Prime 80 points 200 Project Euler Project Euler 008 – Largest Product of Consecutive Digits 100 points 201 Project Euler Project Euler 009 – Pythagorean Triplet 75 points 202 Project Euler Project Euler 010 – Sum of Primes Under Two Million 100 points 203 Project Euler Project Euler 011 – Largest Product of 4 Numbers in Grid 160 points 204 Project Euler Project Euler 012 – First Triangle Number w/501 Divisors 160 points 205 Project Euler Project Euler 013 – Sum 100 Fifty-Digit Numbers 80 points 206 Project Euler Project Euler 014 – Longest Collatz Sequence 150 points 207 Project Euler Project Euler 015 – Routes Through a 20×20 Grid 100 points 208 Project Euler Project Euler 016 – Sum of the Digits of 2^1000 50 points 209 Project Euler < img src="https://r.search.aol.com/pix/projecteuler.png" alt="Project Euler " title="Project Euler" width="16" height="16"/>017 – Letters in One to One Thousand 110 points 210 Project Euler Project Euler 018 – Maximum Sum Path through Triangle 160 points 211 Project Euler Project Euler 019 – Sundays on the 1st of the Month 50 points 212 Project Euler Project Euler 020 – Sum of the Digits of 100! 50 points 213 Graphics Mouse Demo  - code provided 20 points 214 Graphics Traffic Light – Drawing Shapes and Clicking Them  - code provided 40 points 215 Graphics Shapes Demo – Easily Drawing and Transforming Shapes  - code provided 1 points 216 Graphics Last Clicked – Drawing Boxes Where You Clicked  - code provided 1 points 217 Graphics No Erasey – Making Stuff Stay on the Screen  - code provided 1 points 218 Graphics Drag Location – Getting Drags instead of Clicks  - code provided 1 points 219 Graphics Drawing Layers  - code provided 1 points 220 Graphics Etch-A-Sketch  - code provided 20 points 221 Graphics Bouncing Ball  - code provided 1 points 222 Graphics Pong  - code provided 100 points 223 Graphics Reversi  - code provided 200 points 224 Projects Project: Paint 200-500 points

Source Article