Just glancing at the code. You never call setColor, so the values of rVal, bVal and gVal aren't ever changed by anything. Rethink your design...
Type: Posts; User: AGunner
Just glancing at the code. You never call setColor, so the values of rVal, bVal and gVal aren't ever changed by anything. Rethink your design...
Yes, but you have a bit to learn first, below is some example code for you to peruse. See how much you can understand. Have a look on google for ' java objects' and read around. If you have...
Well, consider what information you need to store: I suspect the answer is the total cost after every customer. Then where would you put this variable and when would it need to be changed.
Well, you want to sort the 4 attributes, so when you loop through the ages, why do you only move the age? Why not move the values in the other 3 arrays as well?
Have a look at this link: CLICKY
It explains comparable and compareTo() pretty well.
Lets start with a basic point: your for loop.
int var1 = -1;
{
for ( int var2 = 0 ; var2 < slabType.length ; var2++ )
if (var2 == 0) return var1 = 0;
.....
}
No Problem. Your code was already very solid, just a small change to the logic that you were able to make yourself.
Good luck with the exams :)
Possibly DrJava was just getting involved in the last gasp effort by annoying you. Would be normal :D
To understand why you want to calculate OUTSIDE of the inEquals() method consider the below:...
Are you sure :D
I am testing your code with the variable types changed and it is working for me. 9*9*9=729.......
The below is identical to your code?
public class Calculator{
You should be getting an error:
Your inDigit method takes an integer value, but you are passing it a long.
Change the variable types in Calculator back to Long?
PS: Your instruction following...
Can you post your current CalculatorPanel?
Thanks :)
Your problem is that you are only performing calculation when the final '=' sign is pressed. In reality you shouldn't care when this occurs - the simple calculator cares not for BIDMAS or any other...