Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package hhhhh;
- /**
- *
- * @author sajib
- */
- public abstract class SpaceCraft {
- protected String model;
- public SpaceCraft(String model) {
- this.model = model;
- }
- public abstract void display();
- }
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package hhhhh;
- /**
- *
- * @author sajib
- */
- public interface Drive {
- public void drive();
- public void stop();
- public void turn();
- }
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package hhhhh;
- /**
- *
- * @author sajib
- */
- public interface Shuttle {
- public void startShuttle();
- public void stopShuttle();
- }
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package hhhhh;
- /**
- *
- * @author sajib
- */
- public class Apollo extends SpaceCraft implements Drive,Shuttle {
- private int nowheel;
- public Apollo(int nowheel, String model) {
- super(model);
- this.nowheel = nowheel;
- }
- public void display() {
- System.out.println(model+"\n"+nowheel);
- }
- public void drive() {
- System.out.println("drive");
- }
- public void stop() {
- System.out.println("stop");
- }
- public void turn() {
- System.out.println("turn");
- }
- public void startShuttle() {
- System.out.println("startShuttle");
- }
- public void stopShuttle() {
- System.out.println("stopShuttle");
- }
- public static void main(String[] args)
- {
- Apollo obj=new Apollo(8,"v974");
- obj.display();
- obj.drive();
- obj.stop();
- obj.turn();
- obj.startShuttle();
- obj.stopShuttle();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment