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.
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.