Created
August 6, 2009 20:09
-
-
Save davetron5000/163542 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Date | |
class MeterRead(val date:Date,rawUsage:Int,val contribution:Float) { | |
val usage = rawUsage / contribution | |
def +(added:Int) = new MeterRead(date,(usage + added).intValue,1.0F) | |
override def toString = "Read on " + date + ", usage " + usage | |
} | |
object Main extends Application { | |
val read = new MeterRead(new Date,10,0.5F) | |
val more = read + 10 | |
println(read) | |
println(more) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment