Results 21 to 40 of 83
Thread: Illegal expression
- 12-09-2009, 12:19 AM #21
Member
- Join Date
- Dec 2009
- Posts
- 5
- Rep Power
- 0
- 12-09-2009, 12:20 AM #22
Member
- Join Date
- Dec 2009
- Posts
- 20
- Rep Power
- 0
- 12-09-2009, 12:31 AM #23
Member
- Join Date
- Dec 2009
- Posts
- 20
- Rep Power
- 0
Does this look right???
[QUOTE=tinman;94730]what you stuck with[/QUOTE
Really stuck on this code, have done it loads of diff ways.
public int changeFace(int n);
{
if ((n >= 6) || (n <= 0))
{
OUDialog.alert("Argument to changeFace() message " + (n) +" is out of range");
}
else
{
return this.face(n);
}
}
Oli
- 12-09-2009, 12:35 AM #24
Member
- Join Date
- Dec 2009
- Posts
- 20
- Rep Power
- 0
- 12-09-2009, 12:44 AM #25
Member
- Join Date
- Dec 2009
- Posts
- 10
- Rep Power
- 0
I sent you a PM with the approach I took.
- 12-09-2009, 12:47 AM #26
Member
- Join Date
- Dec 2009
- Posts
- 20
- Rep Power
- 0
- 12-09-2009, 12:51 AM #27
Member
- Join Date
- Dec 2009
- Posts
- 20
- Rep Power
- 0
..
..........
- 12-09-2009, 12:57 AM #28
Member
- Join Date
- Dec 2009
- Posts
- 10
- Rep Power
- 0
yeah it's vanished somehow :(
never mind, I just said that I'd used nested ifs, it looks a bit messy but seems to work.
for the next bit I used a mixture of the reset() method and the right() method from the marionette project.
That bloody background square though....
- 12-09-2009, 12:58 AM #29
Member
- Join Date
- Dec 2009
- Posts
- 20
- Rep Power
- 0
- 12-09-2009, 12:59 AM #30
Member
- Join Date
- Dec 2009
- Posts
- 20
- Rep Power
- 0
- 12-09-2009, 02:32 PM #31
Member
- Join Date
- Dec 2009
- Posts
- 11
- Rep Power
- 0
OP here,
I'm not looking for answers here to questions just to guidance of wheather I'm on the right track or not. And that first post could be totally wrong!. I don't think the unit books properly prepared us for this question instead, I understand things in the books but this question is difficult to me and with no one to help the java forums seems to be the best place to ask.
- 12-09-2009, 03:03 PM #32
Member
- Join Date
- Dec 2009
- Posts
- 10
- Rep Power
- 0
hi mate,
Have you spoken with your tutor? If you're stuck on a question he can tell you which section of the books to look at.
Have you got the change background method working yet? I can't get that square to update:confused:
finished the rest though :)
- 12-09-2009, 03:34 PM #33
Member
- Join Date
- Dec 2009
- Posts
- 3
- Rep Power
- 0
I'd totally agree with that, I can see how the java concepts work in the book and the activities, but i struggle to apply them to the question without searching for help on place like this.
It doesn't help that I emailed my tutor asking for help last thursday and it took him 6 days to reply, so I now have 1 day left to finish the question!
OP, for ii) I have used the same idea as kyussy and used if - else -if statements for the possible values of n. I can't get it to work yet but i'm just going to hand it in as i need to move on to the next bit now. Next TMA i'm going to do each question as I finish the relevent chapter so i don't get into this situation again!
Kyussy, have you used update(), reset() in the background method? I'm just working on that now.
I was thinking if I used bg.setXpos(75) it would only work the first time the code was used, so can we say bg.setXpos(bg.getXpos + 75) or have I just made that up? lol
- 12-09-2009, 03:48 PM #34
Member
- Join Date
- Dec 2009
- Posts
- 10
- Rep Power
- 0
call him and get an extension!
bg.setXpos(bg.getXpos + 75)
I used background rather than bg, it won't work for me with bg as it's not declared. I also have this. in there.
try if n<=1 && n <=6
if n== 1 etc
if etc...
else alert!Last edited by kyussy; 12-09-2009 at 03:53 PM. Reason: ..
- 12-09-2009, 04:03 PM #35
Member
- Join Date
- Dec 2009
- Posts
- 3
- Rep Power
- 0
- 12-09-2009, 06:46 PM #36
Member
- Join Date
- Dec 2009
- Posts
- 24
- Rep Power
- 0
Hi
any advice on how to assign the arguments to the instance variables in (i)
everytime i try to assign them just comes up with error messages
thanks
-
- 12-09-2009, 07:23 PM #38
Member
- Join Date
- Dec 2009
- Posts
- 24
- Rep Power
- 0
public Dice(Square bg, Circle tL, Circle tM, Circle tR, Circle mid, Circle bL, Circle bM, Circle bR)
{
this.background = bg;
this.topLeftSpot = tL;
this.topMiddleSpot = tM;
this.topRightSpot = tR;
this.middleSpot = mid;
this.bottomLeftSpot = bL;
this.bottomMiddleSpot = bM;
this.bottomRightSpot = bR;
this.reset();
this.length = 70;
- 12-09-2009, 07:25 PM #39
Member
- Join Date
- Dec 2009
- Posts
- 24
- Rep Power
- 0
the code comes with no errors but then i need to execute a statement
Square s = new Square(); which results in an error:
Semantic error: Cannot cast Circle to Square
- 12-09-2009, 07:26 PM #40
Member
- Join Date
- Dec 2009
- Posts
- 33
- Rep Power
- 0
Similar Threads
-
Illegal Start of expression
By Macca07 in forum New To JavaReplies: 3Last Post: 11-23-2009, 08:43 AM -
Illegal start of expression
By Basit56 in forum New To JavaReplies: 2Last Post: 08-18-2009, 09:12 AM -
Illegal Start of an Expression
By David55 in forum CLDC and MIDPReplies: 8Last Post: 11-02-2007, 09:11 PM -
Illegal start of expression
By gabriel in forum New To JavaReplies: 2Last Post: 08-01-2007, 05:09 PM -
Illegal Start of an Expression
By David55 in forum CLDC and MIDPReplies: 0Last Post: 04-20-2007, 05:59 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks