Object-Oriented Programming with Java, part I – Exercise 46

This program involves two methods, sum and average. Sum returns the sum of the four numbers and average calculates the average using that sum. My Code Model Code Comments I like my one better than the model code on this one. Maybe not quite as clear but better.

Object-Oriented Programming with Java, part I – Exercise 45

This method compares three numbers and then returns the largest one to the main program. My Code Model Code Comments The model solution is quite different from mine and I have to say nicer although mine has less lines, theirs is easier to read.

Object-Oriented Programming with Java, part I – Exercise 44

This programs create the method least, which returns the least of the numbers given as parameters. If the parameters are equal, you can decide which one is returned. My Code Model Code Comments Same problem as last time. I created a new variable and then got return to pass it instead of just using return […]

Object-Oriented Programming with Java, part I – Exercise 40

This program gets you to create three methods, one for white-spaces and one for stars. The third method combines the other two to create Christmas tree shapes. My Code Model Code Comments Mine is very messy compared to the model solution.

Object-Oriented Programming with Java, part I – Exercise 39

This programs creates a method printStars that prints the given amount of stars and a line break and then uses that in other methods to print a square, rectangle and triangle. My Code Model Code Comments This had me buggered for a while and it turned out the error was because I was printing a […]