Java help

Orsorum

Lifer
Dec 26, 2001
27,631
5
81
Okay, I never thought I'd be asking for help... argh.

Intro programming class, we're making imitation versions of calculators in Java. I have the user interface done, I'm just making the engine that actually runs the calculations and sends the displayed value to the userinterface.

I have the initial part of the displayed value finished... I'm trying to figure out how to update the display value if multiple buttons are pressed... i.e.

public int getDisplayValue() {
return this.displayValue;
}

public void numberPressed(int number) {
this.displayValue = number;
}

I have to be able to update displayValue as a 10's digit, then a 100's digit, etc, if the button is pressed repeatedly. I'm also going off the knowledge that I'll have to use the statement "this.displayValue = (this.displayValue * 10) + number;" I'm so lost.

I have no idea how to do this!! If anyone has any suggestions, I'd appreciate it.
 

Orsorum

Lifer
Dec 26, 2001
27,631
5
81
Hehe, nevermind... just figured it out.

DANGIT, THAT'S TOO FREAKIN' SIMPLE.... argh. Right on the tip of my brain the entire time, too.