In Java, Ship Implementing With Cargo And Cruise Ship

import java.util.List;
import java.util.ArrayList;

public class TestShip{
	public static void main(String[]args){
		List<Ship> ships = new ArrayList<>();
		ships.add(new Ship("NSU Vic", 1884));
		ships.add(new Ship("NSU Column", 1902));
		ships.add(new CruiseShip("Java Queen 1", 2003, 450));
		ships.add(new CruiseShip("CIS Minnow", 2010, 250));
		ships.add(new CargoShip("Demon 1", 1999, 7000));
		ships.add(new CargoShip("Demon 2", 1993, 10000));
		for(Ship s: ships){
			System.out.println(s.toString());
		}
	}
}
Download

Comments

Popular posts from this blog