help, i am a newbie

Reply

Join Date: Oct 2009
Posts: 4
Reputation: Treezwithgunz is an unknown quantity at this point 
Solved Threads: 0
Treezwithgunz Treezwithgunz is offline Offline
Newbie Poster

help, i am a newbie

 
0
  #1
Oct 10th, 2009
I am trying to write a program that will give me the volume of a cylinder when I run it. I already have a Circle class that computes the area of a circle. I am also using a seperate program to handle the input and output. Could someone tell me what I am doing wrong with my program?
  1. public class Cylinder
  2. {
  3. // calls up and creates an object from the Circle class
  4.  
  5. Private Circle base;
  6. Private double Height;
  7.  
  8. //Constructor
  9. Public Cylinder(double h, double r)
  10. {
  11. // creates object from cirle class
  12. Circle base = new circle(r);
  13. height = h;
  14. }
  15. public double getVolume()
  16. {
  17. return CircleBase.area * height;
  18. }
  19. }
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 3,584
Reputation: jasimp has a spectacular aura about jasimp has a spectacular aura about jasimp has a spectacular aura about 
Solved Threads: 51
Featured Poster
jasimp's Avatar
jasimp jasimp is offline Offline
Senior Poster
 
0
  #2
Oct 10th, 2009
What are you having a problem with? You told us what your program is supposed to do, and that its not working, but you never told us exactly what part isn't working.
"Argyou not with the hand you are dealt in cards or life." ---- Wizard and Glass
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 4
Reputation: Treezwithgunz is an unknown quantity at this point 
Solved Threads: 0
Treezwithgunz Treezwithgunz is offline Offline
Newbie Poster
 
0
  #3
Oct 11th, 2009
I am sorry, I am new XP

i keep getting "Reached end of file while parsing" and all the brackets are there. What am I doing wrong!
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 120
Reputation: Jocamps is an unknown quantity at this point 
Solved Threads: 7
Jocamps's Avatar
Jocamps Jocamps is offline Offline
Junior Poster
 
0
  #4
Oct 11th, 2009
looking at your code... did you copy and paste that? if yes then, you need to ensure that "public" and "private" modifiers are in lowercase.
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 1,566
Reputation: BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all 
Solved Threads: 196
BestJewSinceJC BestJewSinceJC is offline Offline
Posting Virtuoso
 
0
  #5
Oct 11th, 2009
Private and Public should be changed to private and public. They are supposed to be lowercase - I think it will give you a compiler error otherwise.
Out.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 120
Reputation: Jocamps is an unknown quantity at this point 
Solved Threads: 7
Jocamps's Avatar
Jocamps Jocamps is offline Offline
Junior Poster
 
0
  #6
Oct 11th, 2009
Originally Posted by BestJewSinceJC View Post
Private and Public should be changed to private and public. They are supposed to be lowercase - I think it will give you a compiler error otherwise.
that's what i said...and yes it will definitely give you a compiler error
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 1,566
Reputation: BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all 
Solved Threads: 196
BestJewSinceJC BestJewSinceJC is offline Offline
Posting Virtuoso
 
0
  #7
Oct 11th, 2009
Oh, sorry man. Didn't mean to step on your toes, I don't know why I didn't read that part of your response or didn't register it or something.

Edit: Also, I don't know why somebody would down vote my post. I am a regular poster here and I never 'repeat responses' or anything like that - I don't even respond if I have nothing to contribute - this was obviously an accident.
Last edited by BestJewSinceJC; Oct 11th, 2009 at 10:54 pm.
Out.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 4
Reputation: Treezwithgunz is an unknown quantity at this point 
Solved Threads: 0
Treezwithgunz Treezwithgunz is offline Offline
Newbie Poster
 
0
  #8
Oct 12th, 2009
Thanks you guys. I fixed the cases, but I still get the "reached end while parsing error.

One thing I should note is that when I do get that error I also get

Public class cylinder>
^

directly underneath it
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 1,566
Reputation: BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all BestJewSinceJC is a name known to all 
Solved Threads: 196
BestJewSinceJC BestJewSinceJC is offline Offline
Posting Virtuoso
 
0
  #9
Oct 12th, 2009
I don't see any other errors. . can you re-post your updated code? It seems like it still thinks your case is wrong somewhere.
Out.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 120
Reputation: Jocamps is an unknown quantity at this point 
Solved Threads: 7
Jocamps's Avatar
Jocamps Jocamps is offline Offline
Junior Poster
 
0
  #10
Oct 12th, 2009
when you created your Circle class you had your "circle" in lowercase it should be in Uppercase.

Circle base = new Circle(r);
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC