List of Exercises

Table 2. Exercises in 113105 Software development 1
Chapter Exercise
No. Title Status of completion
Getting started 1 Extending class HelloWorld
2 Working with variables
3 A conditional
4 A loop
Language Fundamentals 5 Hotel key cards
6 Literal samples
7 Literals of type int
8 Integer overflow
9 Strange sum result
10 Correcting the error
11 Legal variable names
12 Benefits of final
13 «C» vs. Java.
14 Assignment and type safety
15 Inventing tinyint.
16 An int's minimum and maximum value
17 Pretty may not be pretty
18 Strange output
19 Poor mans ASCII table
20 Integer value hexadecimal representation
21 Binary literals
22 Testing the limits (Difficult)
23 Why using braces in System.out.println(...) ?
24 Composing strings of literals and variables
25 Escaping double quotes
26 Supplementary string exercises
27 int and char
28 float vs. double
29 int to char narrowing problems
30 Get a byte from 139
31 Ariane, I miss you!
32 Reducing long to int (difficult)
33 Calculating a circle's area
34 Dividing values
35 Strange things with operator ++
36 Adding values
37 Representational float and double miracles
38 Expressions involving infinity
39 int to short assignment
40 int to short assignment using final
41 Calculating a circle's area avoiding accidental redefinition
42 Turning weeks into seconds
43 Turning seconds into weeks
44 Using predefined Java™ standard library constants
45 Converting temperature values
46 Time unit conversion
47 Interest calculation
48 Summing short and char
49 Operator & vs. &&
50 Strange addition
51 Understanding +=
52 Three ways expressing the same
53 Guessing results
54 Cleaning up the mess
Statements 55 Blocks and variable glitches
56 Providing better display
57 Comparing for equality
58 Replacing else if (...){...} by nested if ... else statements
59 Post modifying an exam's marking
60 At the bar
61 Roman numerals
62 Leap years
63 Why break?
64 Extending to month days
65 Converting day's names to numbers.
66 Day categories.
67 Roman numerals, using switch
68 Generating square numbers
69 Calculating factorial
70 Even or odd?
71 Square root approximation
72 Printing numbers
73 Printing just even numbers
74 Merry Xmas
75 More fun with Xmas trees
76 A basic square number table
77 Tidy up the mess!
78 HTML-ify me
79 Auxiliary Example, part 1: A multiplication table
80 Auxiliary Example, part 2: Avoiding redundant entries
81 Creating a real square table
82 Creating a sophisticated HTML version of your square table
83 Display all summands
84 Playing lottery
85 Guessing numbers
86 Smallest multiple
87 Smallest multiple, purely algebraic solution
88 Pythagorean triples
89 Avoiding duplicates and gaining performance
Objects and Classes 90 Compile time error
91 An Address class
92 Understanding access control
93 Explaining times
94 Implementing getter methods
95 Method signature variants
96 Will a match be found?
97 Modeling geometry objects: Rectangles
98 Modeling circles
99 Adding translations and SVG export.
100 Extending the employee example.
101 Refining access to an employee's attributes
102 File system representation
103 Your personal String class
104 Constructors variable names and this.
105 Class vs. instance
106 Distinguishing leap- and non-leap years
107 A method for printing square numbers using for, while and do ... while
108 Nicely formatting sine values.
109 Extending our interest calculator
110 Integer value considerations.
111 Programmer's favourite expression
112 Lotteries revisited
113 Finding the greatest common divisor of two integer values
114 Dealing with IBAN numbers
115 Cancelling fractions
116 Dealing with local Maven dependencies
117 DNS inflicted groupId / package names clashes
118 Details on execution
119 Maximum and absolute value
120 Factorial, the direct way
121 Factorial, the recursive way
122 Binomials, the recursive way
123 The exponential f x = e x
124 Implementing sin ( x ) .
125 Summing up in a different order.
126 Summing up integers to a given limit
127 Summing up, the better way
128 Turning seconds into weeks, part 2
129 Example: A class representing fractions
130 Compass directions
131 Compass direction neighbours
132 Former zodiac examination task
133 git local, DIY
134 git distributed, DIY
Core Classes 135 Choosing a good hashCode() method
136 String and good hashCode() implementations.
137 Common pitfall using trigonometric functions
138 Using constants from java.lang.Math.
139 Strings on CodingBat
140 Masking strings
141 Analyzing strings
142 Pitfalls using ==: Equality of String instances
143 Weird, weirder, weirdest!
144 Analyzing file pathnames
Arrays 145 Assignment to final variable?
146 Converting string arrays to HTML.
147 Route navigation
148 Examinations and mark frequencies
149 Pangram checker
150 Reconsidering System.out.format().
151 Understanding search results
152 Implementing append directly
153 Purge duplicates
154 A container of fixed capacity holding integer values
155 Allow for variable capacity holding integer values
156 Reading console input
157 Prettifying output representation
158 2-dimensional arrays and .length
159 External array and string exercises
160 Tic-tac-toe using a two-dimensional array
161 Changing the game's internal representation
162 Tic-tac-toe, Computer vs. human
163 Adding support to retrieve statistical data.
164 Testing an implementation
165 Improving prime number calculation performance
166 Calculating the median
167 A simple character based plotting application
Inheritance 168 Let me pass, please!
169 Why is == correctly comparing enum instances?
170 String vs. StringBuffer
171 Alternate implementation of opposite directions
172 Defining a Shape class hierarchy
173 Scaling shapes
174 Providing toString() methods
175 protected vs. package private
176 protected access involving different instances
Error Handling 177 Mind your prey
178 Expected exception test failure
Working with Numbers 179 Auto boxing int to Double?
180 Why using String userInput = null?
181 Parsing short values
182 Parsing short values in hexadecimal representation
183 Locale definitions
184 Formatting int, double and LocaleDate
185 Chaining subtract method calls
interface definitions and abstract Classes 186 Understanding Arrays.sort()
187 Sorting Rectangle instances by width
188 Sorting Rectangle instances by width and height
189 Adding flexibility in sorting rectangles
190 A nonsense generator
191 An interface based plotter
Application deployment I 192 Various integer array algorithms
193 A command line version computing a sample's average and median
Reading character streams 194 Adding line numbers to text files
195 A partial implementation of GNU UNIX wc
Collections 196 Inserting strings into a Set.
197 Inserting strings into a List.
198 Representing integer coordinate values
199 Inserting Coordinate instances into a Set.
200 Getting a text's set of words.
201 A text's set of words in alphabetic order
202 Implementing unusual string sorting.
203 Words and corresponding frequencies
204 Formatting an address list
205 Implementing a set of strings
206 Implementing word frequencies by Map<String, Integer> instances.
207 Regain sorting capabilities.
208 Creating an overview of grades showing frequencies
209 Creating an overview of grades showing individual names