keith

Keith Petty
Sun Certified Java Programmer
Intranet Web Developer at Zions Bancorporation, Salt Lake City Utah.



Overloading Methods
Written by Keith Petty   
Tuesday, 07 October 2008 00:00
Assuming that we want to compare two computers we would first need a way to rate a computer.

We are going to expand on our Computer Class by adding a method to give a rating to a computer based on a number of factors.

The data within each computer that will come into play when we rate a computer is:
	    int speed;

int diskspace;

int monitor;

boolean floppy;

boolean dvd;

The method will return an int, it will take no parameters, and we will call it getRating.

Points are calculated as follows.
Speed @ 1 pt per Mhz
Diskspace @ 10 pts per GB
Monitor @ 20 pts per diagonal inch
100 pts for a DVD
10 pts for a floppy

Here is the code----
	    int getRating() {

int rating;

rating = speed;

rating = rating + diskspace * 10;

rating = rating + monitor * 20;

if(dvd) {

rating += 100

}

if(floppy) {

rating += 10;

}

return rating;

}

Read more... [Overloading Methods]
 
Overloading Constructors
Written by Keith Petty   
Saturday, 14 July 2007 06:05
Today we are going to Overload the Computer.
No... wait... thats... Overload the constructor of a Computer.
Ok... I think I got it this time... were Overloading the constructor of a Class “called” Computer.
Ah yes... thats better.
Read more... [Overloading Constructors]
 
Memory and the Java Runtime.exec Process
Written by Keith Petty   
Wednesday, 21 February 2007 11:01

Today, we will be learning how to get a Mac address off of your machine and that Java's memory management
does not work on external processes run by the operating system even if they were invoked by a call from
within a running Java class.

Read more... [Memory and the Java Runtime.exec Process]
 
Object-oriented Programming in Java
Written by Keith Petty   
Wednesday, 10 January 2007 11:45

I see old-fashioned procedural programming concepts being used in object-oriented languages.  I also see dead people, they're everywhere.

As a freelance programmer specializing in Java I often find myself working with legacy code that is not only poorly documented but often contains three to four times as many lines of code as is necessary to accomplish the task.

It also amazes me how often I see old-fashioned procedural programming concepts being used in spite of the fact that the programmer is writing in a true object-oriented language.

Read more... [Object-oriented Programming in Java]
 

blog menu