I am making a program of vehicles and i have to make a car garage class. In the class the max amount of vehicles that could enter are 20 or 25000 lbs. I wrote the charstack and the pop() and the push() but dont know how to limit it to 20 vehicles or 25000 lbs. Could someone help with this. Also, I have a problem with the vehicle interface in my program. other classes come with an error so I threw an exception but we are supposed to add code to the classes to make them compile.
package saturn;
import java.util.Stack;
public class Saturn {
interface Domestic {}
interface Import {}
interface Japanese extends Import {}
interface German extends Import {}
interface Detroit extends Domestic {}
interface SpringHill extends Domestic {}
interface Vehicle
{
int getWeightInPounds(double Automobile, double LargeAutomobile );
double Automobile = 1000;
double LargeAutomobile = 2500;
}
interface Automobile extends Vehicle {}
interface LargeAutomobile extends Vehicle {}
interface Sedan extends Automobile {}
interface Van extends LargeAutomobile {}
interface Truck extends LargeAutomobile {}
interface Compact extends Automobile {}
interface SportsUtilityVehicle extends Truck, Van {}
class SaturnSL1 implements SpringHill, Sedan // All of this is the spot where there is a compile error.
{
@Override
public int getWeightInPounds(double Automobile, double LargeAutomobile) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
class HondaCivic implements Japanese, Compact
{
@Override
public int getWeightInPounds(double Automobile, double LargeAutomobile) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
class MercedesC230 implements German, Sedan
{
@Override
public int getWeightInPounds(double Automobile, double LargeAutomobile) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
class ChevyS10 implements Detroit, Truck
{
@Override
public int getWeightInPounds(double Automobile, double LargeAutomobile) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
class SubaruOutback implements Japanese, SportsUtilityVehicle
{
@Override
public int getWeightInPounds(double Automobile, double LargeAutomobile) {
throw new UnsupportedOperationException("Not supported yet.");
}
}
public static void main(String[] args)
{
class ParkingGarage
{
private Stack vehiclesInGarage;
ParkingGarage()
{
vehiclesInGarage = new Stack();
}
public char peek()
{
Character temp = (Character) vehiclesInGarage.peek();
return temp.charValue();
}
public void push( char vehicle)
{
vehiclesInGarage.push(new Character(vehicle));
}
public char pop()
{
Character temp = (Character) vehiclesInGarage.pop();
return temp.charValue();
}
public boolean empty()
{
return vehiclesInGarage.empty();
}
}
}
}