Super class is not functioning, as when the Steelfactory class try's to get the data from the super class, the output shows that there is noting there. Looking to solves as to why this might be happening. The Factory called null with 0makes cars at a rate of 0since the year 1998 I am wondering if it is due to, having called my super class wrong, but I did not gain any errors when writing it. Or could there there be another issue in the code logic wise? The code:
package finalsproject;
static abstract class Factory {
//Atributes:
String factoryName; //The name of the factory
int employeeAmount; // number of workers in the factory
int producedAmount; // number of products made
// Constructor:
public Factory (String ifactoryName,int iemployeeAmount,int iproducedAmount) {// Prameterized consrtuctor
factoryName = ifactoryName;
employeeAmount = iemployeeAmount;
producedAmount = iproducedAmount;
}
//Methods:
public abstract String getFactoryName();
public abstract int getEmployeeAmount();
public abstract int getProducedAmount();
}
//The class SteelFactory must have the following specifications
//-It must implement the abstract class Factory
//Make these two classes implement the abstract class above
static class SteelFactory extends Factory {
//Attributes:
String factoryName; // Name of the factory
int employeeAmount; // Number of workers
int producedAmount; // number of products
int yearCreated; // the year the factory was made
//Constructor:
public SteelFactory (String ifactoryName,int iemployeeAmount,int iproducedAmount,int iyearCreated) {
super ( ifactoryName, iemployeeAmount,iproducedAmount);
yearCreated = iyearCreated;
}
// Methods
public String getFactoryName() {
return (factoryName);
}
public int getEmployeeAmount() {
return (employeeAmount);
}
public int getProducedAmount() {
return (producedAmount);
}
public String toString () {
return ("The Factory called " + factoryName + " with " + employeeAmount + "makes cars at a rate of " + producedAmount + "since the year "+ yearCreated);
}
}