View Single Post
  #1 (permalink)  
Old 04-07-2008, 08:23 AM
Bizmark Bizmark is offline
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.
Reply With Quote
Sponsored Links