i am having a bit of trouble making this work
i cant seem to fix the errors, maily about the super(); bits, and the beginning variables. what have i done wrong?Code:import java.awt.*; import java.applet.Applet; public class transport extends Applet{ skateboard Skateboard1; skateboard Skateboard2; motorbike Motorbike1; bike Bicycle1; bike Bicycle2; car Car1; car Car2; public void init(){ this.setLayout(new Gridlayout(7.1)); Skateboard1=new skateboard(); add(Skateboard1); Skateboard2=new skateboard(); add(Skateboard2); Motorbike1=new motorbike(); add(Motorbike1); Bicycle1=new bike(); add(Bicycle1); Bicycle2=new bike(); add(Bicycle2); Car1=new car(); add(Car1); Car2=new car(); add(Car2); } public class vehicle extends Panel{//vehicle class, main class Label make=new Label(); Label model=new Label(); Label colour=new Label(); Label cost=new Label(); Label length=new Label(); public class motorbike extends vehicle{// Motorbike class Label engine=new Label(); Label fuel=new Label(); Label height=new Label(); Label regno=new Label(); Label acceleration=new Label(); motorbike(){ super(); make.setText("Make is: UNKNOWN"); model.setText("Model is: UNKNOWN"); colour.setText("colour is: UNKNOWN"); cost.setText("cost is: UNKNOWN"); length.setText("length is: UNKNOWN"); engine.setText("engine is: UNKNOWN"); fuel.setText("fuel is: UNKNOWN"); height.setText("height is: UNKNOWN"); regno.setText("reistration is: UNKNOWN"); acceleration.setText("acceleration is: UNKNOWN"); add(make); add(model); add(colour); add(cost); add(length); add(engine); add(fuel); add(height); add(regno); add(acceleration); } public class car extends motorbike{// Car class, Subclass of motorbike Label passengers=new Label(); car(){ super(); passengers.setText("Number of passengers is: UNKNOWN"); add(passengers); } } } public class unpowered extends vehicle{//unpowered class Label weight=new Label(); unpowered(){ super(); weight.setText("Weight is: UNKNOWN"); add(weight); } public class skateboard extends unpowered{//skateboard class, subclass of unpowered Label width=new Label(); skateboard(){ super(); width.setText("Width is: UNKNOWN"); add(width); } } public class bike extends unpowered{//bike class, subclass of unpowered Label gears=new Label(); bike(){ super(); gears.setText("The number of gears is: UNKNOWN"); add(gears); } } } } }


Reply With Quote


Bookmarks