# Search:

Type: Posts; User: why_always_me

1. ## Thread: Java Calculator problems

by why_always_me
Replies
11
Views
1,104

### Re: Java Calculator problems

Hi yeah I forgot to change it to 10.

I am now having the code give me the same answer for each equation the out put is:

49+62*61-36
15.666666666666668
4/64
15.666666666666668
2. ## Thread: Java Calculator problems

by why_always_me
Replies
11
Views
1,104

### Re: Java Calculator problems

Hi I managed to get it working for one equation by moving the end bracket of the while statement to line 101.

I am now getting the following error:
3. ## Thread: Java Calculator problems

by why_always_me
Replies
11
Views
1,104

### Re: Java Calculator problems

Hi

I have tried that and I am unable to find the reason for it just using the last token.

Basically what happens is when I call the RPNtoDouble function I was printing the token that was being...
4. ## Thread: Java Calculator problems

by why_always_me
Replies
11
Views
1,104

### Re: Java Calculator problems

sorry I added the description so it was clear what they should be.

at the minute the input file contains only:
49+62*61-36

and the output should be
49+62*61-36
[49+62*61-36]
3795
5. ## Thread: Java Calculator problems

by why_always_me
Replies
11
Views
1,104

### Re: Java Calculator problems

Hi the program currently outputs:

49+62*61-36
[36]
36.0

whereas the program should be giving me

49+62*61-36
6. ## Thread: Java Calculator problems

by why_always_me
Replies
11
Views
1,104

### Java Calculator problems

Hi Everyone

My code is an implementation of the shunting yard algorithm - Shunting-yard algorithm - Wikipedia, the free encyclopedia to convert infix expressions to postfix. I then try and solve...
7. ## Thread: Java calculator implementation

by why_always_me
Replies
5
Views
1,343

### Re: Java calculator implementation

Hi Guys my new thinking is :

List class
Node class
Shunting yard class
Main class
Main includes the reverse Polich notation, filereader and tokenizer.

My question now is how would i...
8. ## Thread: Java calculator implementation

by why_always_me
Replies
5
Views
1,343

### Re: Java calculator implementation

so my thinking now is to have the following classes:

stack class
main - filereading, dealing with the numbers+operands
shunting yard class

Is this an acceptable sort of hierarchy?

thanks
9. ## Thread: Java calculator implementation

by why_always_me
Replies
5
Views
1,343

### Re: Java calculator implementation

Hi thanks for the help.

How would I implement my own stack without using the java utils?

also what sort of hierarchy should i use? I was thinking maybe a filereader class and then one to deal...
10. ## Thread: Java calculator implementation

by why_always_me
Replies
5
Views
1,343

### Java calculator implementation

am basically attempting to create a calculator using a class hierarchy - the basic function will be:

Convert the String representation into a list of Tokens
Convert the List of Tokens into Polish...
11. ## Thread: Java programme to colour in a grid

by why_always_me
Replies
20
Views
1,450

### Re: Java programme to colour in a grid

Hi so i tried using if statements to set my rNum variable and it never changes from 0? any ideas?

int rNum=0;
int cNum=0;
...
12. ## Thread: Java programme to colour in a grid

by why_always_me
Replies
20
Views
1,450

### Re: Java programme to colour in a grid

Hi I have now found out how to use the split method correctly. here is my piece of code used for an example as you suggested.

public class SplitExample{

public static void main(String...
13. ## Thread: Java programme to colour in a grid

by why_always_me
Replies
20
Views
1,450

### Re: Java programme to colour in a grid

managed to get jdk 7 working now. still slightly confused by the split() method though. is there any easier way of detecting the R,C and colour?

thanks
14. ## Thread: Java programme to colour in a grid

by why_always_me
Replies
20
Views
1,450

### Re: Java programme to colour in a grid

sorry i am not too sure :(. Can not get any code to compile on my laptop at the minute after trying to install jdk 7. no matter what program i try and run i just get the error could not find or load...
15. ## Thread: Java programme to colour in a grid

by why_always_me
Replies
20
Views
1,450

### Re: Java programme to colour in a grid

i removed the bottom line strLine.removeCharAt(strLine[0]);
and it compiles fine.
16. ## Thread: Java programme to colour in a grid

by why_always_me
Replies
20
Views
1,450

### Re: Java programme to colour in a grid

ok so it should be something like

while ((strLine = br.readLine()) != null) {
strLine.split(" ");
strLine.removeCharAt(strLine[0]);

}
17. ## Thread: Java programme to colour in a grid

by why_always_me
Replies
20
Views
1,450

### Re: Java programme to colour in a grid

ok thanks. so would that mean i would do something like

while ((strLine = br.readLine()) != null) {
strLine.split(" ");
strLine = strLine.substring(0,...
18. ## Thread: Java programme to colour in a grid

by why_always_me
Replies
20
Views
1,450

### Re: Java programme to colour in a grid

Hi I will be determining the correct square by trying to parse the row and column info from the file as well as the colour and then using

buttons[row][col].setBackground(colour)

where row...
19. ## Thread: Java programme to colour in a grid

by why_always_me
Replies
20
Views
1,450

### Re: Java programme to colour in a grid

Hi I have managed to get the colouring in part to work :) but i am now confused on how to do the file reading. below is the new code that colours squares and SHOULD fill some in from the start. the...
20. ## Thread: Java programme to colour in a grid

by why_always_me
Replies
20
Views
1,450

### Re: Java programme to colour in a grid

Hi ok thanks for that. I have now managed to get the squares to change colour. How will i now make them go back to default if they are clicked and they have been coloured in? thanks

here is the...
21. ## Thread: Java programme to colour in a grid

by why_always_me
Replies
20
Views
1,450

### Java programme to colour in a grid

Hi this is my first post here.

basically i want a programme to do teh following:

1)create a 6x6 grid.
2)ask the user to choose from 6 colours to fill a square
3)test to see if one row or...
Results 1 to 21 of 21