Abstract Class

package coding;

public abstract class Automobile {
	
	public void retailPrice(int price) {
		System.out.println("The retail price of this vehicle is " + price);
	}
	public abstract void wheelDrive();
	
	public abstract void passengerCapacity();
	
	public abstract void propulsionType();
	
	public abstract void efficiencyRate();

}
package coding;

public class Avalanche extends Automobile {

	@Override
	public void wheelDrive() {
		// TODO Auto-generated method stub
		System.out.println("Wheel Drive options: 2WH,Auto,4WH,4WL");
	}

	@Override
	public void passengerCapacity() {
		// TODO Auto-generated method stub
		System.out.println("Passenger capacity: 5 adults");
		
	}

	@Override
	public void propulsionType() {
		// TODO Auto-generated method stub
		System.out.println("Propulsion system:  5.3Litre V8");
	}

	@Override
	public void efficiencyRate() {
		// TODO Auto-generated method stub
		System.out.println("Efficiency rate:  15 MPG City/18 MPG Hwy");
		
	}

}

About admin

Richard has worked in the Information Technology field for 25 years on a variety of platforms and lines of business.
This entry was posted in Java. Bookmark the permalink.