Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-07-2008, 08:23 AM
Member
 
Join Date: Apr 2008
Posts: 4
Bizmark is on a distinguished road
[SOLVED] Problem with extending classes...
Hi, I've got a homework assignment that requires us to make multiple classes in multiple files (1 class per file) and then have a main file that utilizes the classes within the other files. Here's how my classes and sub classes are setup:
employee -> paid & volunteer
paid -> hourly & monthly & executive

My files are employee.java, paid.java, volunteer.java, hourly.java, monthly.java, and executive.java; all of these are in the same package called employees. I also have a mainApp.java that utilizes the other files.

The problem I'm having is with the volunteer.java, when I compile it it gives these errors:
Error 1)
volunteer.java:13: cannot find symbol
symbol: class employee
class volunteer extends employee{

Error 2)
volunteer.java:42: cannot find symbol
symbol : variable super
location: class employees.volunteer
String top = super.toString();

And heres the code for volunteer.java:
Code:
package employees; import java.util.*; import java.io.*; import java.text.*; class volunteer extends employee{ private String type; private double earn; /*private String fname = super(fname); private String lname = super(lname); private String address = super(address);*/ public volunteer() { super(); type = "Volunteer"; earn = 0.0; } public volunteer(String first, String last, String addrs) { super(first, last, addrs); type = "Volunteer"; earn = 0.0; } public double earnings() { return this.earn; } public String toString() { String top = super.toString(); return this.type + "\n" + top; } }
Anyone see what's wrong?

Last edited by Bizmark : 04-08-2008 at 12:22 AM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-07-2008, 09:15 AM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 740
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
Welcome to the Forums!

Can you post what the class employee looks like? It might wise for you to also adhere to Java naming conventions. It's very easy to mistake employee for employees, only one is a package and the other is a class..

At a glance, it appears the compiler can't find the employee class, nor the super or super's method toString().
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on July 13, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-07-2008, 11:32 AM
Member
 
Join Date: Apr 2008
Posts: 4
Bizmark is on a distinguished road
I fixed the problem, thanks though =)
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 12:09 AM
CaptainMorgan's Avatar
Moderator
 
Join Date: Dec 2007
Location: NewEngland, US
Posts: 740
CaptainMorgan will become famous soon enoughCaptainMorgan will become famous soon enough
Send a message via AIM to CaptainMorgan
Care to share how you solved your problem?
__________________

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
to our beloved Java Forums!
(closes on July 13, 2008)
Want to voice your opinion on your IDE/Editor of choice?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
!
Got a little Capt'n in you? (drink responsibly)
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 04-08-2008, 12:21 AM
Member
 
Join Date: Apr 2008
Posts: 4
Bizmark is on a distinguished road
Sure, but by the way, it took me from last night at 9:00pm to this morning at 9:30am to finish this program. It was extremely grueling and I wanted to rip my hair out by the time I finished, but it's done and I'm really proud of it . Anyway, the problem was that I was compiling the program from volunteer.java rather than compiling the mainApp.java file which has the main() function in it and, since it uses all my other classes in all those other .java files, it will make the class files itself. That solved that problem, but then a million other problems came up that kept me working all night long, but anyway, its done.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] alignment problem nanimtech JavaServer Pages (JSP) and JSTL 1 04-10-2008 02:23 PM
[SOLVED] Problem with setVisible(); on LINUX lepetitprince AWT / Swing 6 04-07-2008 03:14 PM
[SOLVED] file i/o problem aytidaalkuhs New To Java 3 04-06-2008 07:42 PM
[SOLVED] Actionevent problem Cymro New To Java 3 04-04-2008 08:11 AM
[SOLVED] Problem with code - inheritence yalla New To Java 1 03-30-2008 07:11 AM


All times are GMT +3. The time now is 11:37 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org