Results 1 to 19 of 19
- 11-10-2010, 01:48 PM #1
Member
- Join Date
- Nov 2010
- Posts
- 10
- Rep Power
- 0
- 11-10-2010, 01:51 PM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 8
Lots of people can. Ask a specific question.
- 11-10-2010, 01:52 PM #3
...what's your question?
Read this: How To Ask Questions The Smart Way
- 11-10-2010, 01:57 PM #4
Member
- Join Date
- Nov 2010
- Posts
- 10
- Rep Power
- 0
there are errors in this codes :
Dancer sam = new Dancer();
Semantic error: Typed variable declaration : Constructor error: Can't create instance of an interface: interface Dancer
DancerFrog alice = new Frog();
Semantic error: Cannot cast Frog to DancerFrog
kermit.danceSteps();
Semantic error: Attempt to resolve method: danceSteps() on undefined variable or class name: kermit
- helen.getReady();
Semantic error: Attempt to resolve method: getReady() on undefined variable or class name: helen
I want to know detailed explanation of Semantic error in these code
:(
- 11-10-2010, 02:03 PM #5
What don't you understand about the errors?
Dancer is an interface. You can't directly instantiate an interface.
Frog is not an extension of DancerFrog. Perhaps the other way around?
The variables kermit and helen are undefined in the score you're trying to access them.
It seems to me like you really need to go back to the basic tutorials or the early notes you took, if this is for a class.
- 11-10-2010, 02:22 PM #6
Member
- Join Date
- Nov 2010
- Posts
- 10
- Rep Power
- 0
I am a beginner in Java and c++ and I have alots of Assignments and
Quizzes in this period ,,
ummm mean that this codes: helen.getReady(); + getReady(); I don’t use declarations to create variables that must provide methods to access values stored there.
kermit.danceSteps();
mean I must set a int value (Parameter)inside danceSteps();
right ??
I feel like I want to cry
really confused
- 11-10-2010, 02:25 PM #7
Maybe if you broke down each of your problems into a separate SSCCE that recreated the error, we could explain what they mean. As of now, your questions are way too broad to provide any real help.
Last edited by KevinWorkman; 11-10-2010 at 02:41 PM.
- 11-10-2010, 02:34 PM #8
Member
- Join Date
- Nov 2010
- Posts
- 10
- Rep Power
- 0
ummmm thank you bro
I will see this link and try to solve the rest of the questions
- 11-11-2010, 08:46 AM #9
Member
- Join Date
- Nov 2010
- Posts
- 10
- Rep Power
- 0
o
can anyone see to my Assignment in this link
is my solution correct
.. Is there a mistake ??
can help me in question 1 (ii) >> - DancerFrog alice = new Frog();
Semantic error: Cannot cast Frog to DancerFrog
and the last question2 (d)
please help me :(
- 11-11-2010, 08:14 PM #10
Member
- Join Date
- Nov 2010
- Posts
- 10
- Rep Power
- 0
??
:o
:(
- 11-14-2010, 04:26 AM #11
Member
- Join Date
- Nov 2010
- Posts
- 10
- Rep Power
- 0
:eek:
up :(
- 11-14-2010, 04:30 AM #12
Senior Member
- Join Date
- Feb 2010
- Location
- Waterford, Ireland
- Posts
- 748
- Rep Power
- 4
I am not clicking on some link when you can just as easily post your code here
-
Agree. If the code is too long to post here, then it's too long for us to review. Otherwise if you post it here (with code tags), we'll all have an idea of what your problem(s) may be and how to help you.
Best of luck!
-
Edit: My apologies: it seems that you did show what you've done for portions of your assignment.
Last edited by Fubarable; 11-14-2010 at 05:15 AM.
-
- 11-14-2010, 07:14 AM #16
Member
- Join Date
- Nov 2010
- Posts
- 10
- Rep Power
- 0
I'm sorry for the inconvenience
o:o
(d) Suppose the following statement is executed:
DancerFrog frog2 = frog1;
How many variables are there? How many DancerFrog objects now exist? Explain your answer. [2 marks]
my Solution :
There are two variables : frog1 , frog2
And one object : DancerFrog
First we have this statement Frog frog1 = new Frog() which means we have created a new instance of the class Dancer Frog named frog1 and we set initial values: Position 1 and colour green
Also we have a new instance of the class DancerFrog named frog2 but we did n’t set initial values as frog1.
And for this part of statement : frog2 = frog1
assigned the address of the DanerFrog object referenced by frog1 to the variable frog2.
So both variables, frog1 and frog2 reference the same DanerFrog object.
This is what we mean in this statement : DancerFrog frog2 = frog1
::
it will be DancerDFrog or Frog ?
-
Correct. There are two variables and one object which may be a DancerFrog object (I didn't see the constructor call, so the object can be a Frog object or an object of any class that derives from Frog such as DancerFrog).
frog1 does not reference a DancerFrog object but rather a Frog object. I don't know if its position property is one or the colour green since I have not seen the code for the Frog constructor.First we have this statement Frog frog1 = new Frog() which means we have created a new instance of the class Dancer Frog named frog1 and we set initial values: Position 1 and colour green
I didn't see you setting initial values on frog1, so this statement confuses me.Also we have a new instance of the class DancerFrog named frog2 but we did n’t set initial values as frog1.
correct.And for this part of statement : frog2 = frog1
assigned the address of the DanerFrog object referenced by frog1 to the variable frog2.
So both variables, frog1 and frog2 reference the same DanerFrog object.
Can you clarify this a bit?This is what we mean in this statement : DancerFrog frog2 = frog1
it will be DancerDFrog or Frog ?
- 11-14-2010, 08:50 PM #18
Member
- Join Date
- Nov 2010
- Posts
- 10
- Rep Power
- 0
- 11-15-2010, 05:52 AM #19
Member
- Join Date
- Nov 2010
- Posts
- 10
- Rep Power
- 0
Similar Threads
-
assignment help
By esallender in forum New To JavaReplies: 4Last Post: 10-25-2010, 12:10 PM -
Can somebody help me in my assignment
By coolstruxx in forum NetBeansReplies: 0Last Post: 03-24-2009, 01:27 AM -
I am looking for help with an assignment
By nanoo51969 in forum New To JavaReplies: 1Last Post: 03-23-2009, 09:41 PM -
GUI First Assignment-DUE 8/1/08
By ljk8950 in forum AWT / SwingReplies: 2Last Post: 08-01-2008, 04:23 AM -
First GUI Assignment
By ljk8950 in forum New To JavaReplies: 1Last Post: 07-31-2008, 07:29 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks