Java Code
//interface
interface Movable{
public void moveForward();
public void moveBackward();
public void stop();
public void moveLeft();
public void moveRight();
}
//class Car implements interface
class Car implements Movable
{ //Implementing functions of interface
public void moveForward() //Code for moveForward method of
interface
{
System.out.println("Car drives forward"); //print
}
public void moveBackward() //Code for moveBackward method of
interface
{
System.out.println("Car drives backward"); //print
}
public void stop() //Code for stop method of interface
{
System.out.println("Car parked"); //print
}
public void moveLeft() //Code for moveLeft method of
interface
{
System.out.println("Car turns left"); //print
}
public void moveRight() //Code for moveRight method of
interface
{
System.out.println("Car turns right"); //print
}
}
//class Plane implements interface
class Plane implements Movable
{ //Implementing functions of interface
public void moveForward() //Code for moveForward method of
interface
{
System.out.println("Plane flying forward"); //print
}
public void moveBackward() //Code for moveBackward method of
interface
{
System.out.println("Plane taxiing backward"); //print
}
public void stop() //Code for stop method of interface
{
System.out.println("Plane landed"); //print
}
public void moveLeft() //Code for moveLeft method of
interface
{
System.out.println("Plane flying left"); //print
}
public void moveRight() //Code for moveRight method of
interface
{
System.out.println("Plane flying right"); //print
}
}
//class Ship implements interface
class Ship implements Movable
{ //Implementing functions of interface
public void moveForward() //Code for moveForward method of
interface
{
System.out.println("Ship navigates forward"); //print
}
public void moveBackward() //Code for moveBackward method of
interface
{
System.out.println("Ship navigates backward"); //print
}
public void stop() //Code for stop method of interface
{
System.out.println("Ship docked"); //print
}
public void moveLeft() //Code for moveLeft method of
interface
{
System.out.println("Ship navigates left"); //print
}
public void moveRight() //Code for moveRight method of
interface
{
System.out.println("Ship navigates right"); //print
}
}
public class Main
{
public static void main(String[] args) {
Movable mov[] = {new Plane(), new Car(), new Ship()};
//Creating array of Movable interface which contains the object of
all the classes.
for(int i =0; i<mov.length; i++)
{ //Plane object will call all interface methods when
i =0
//Car object will call all interface methods when i
=1
//Ship object will call all interface methods when i
=2
mov[i].moveForward();
mov[i].moveBackward();
mov[i].stop();
mov[i].moveLeft();
mov[i].moveRight();
System.out.println("-----------------------");
}
}
}
Output

i need this in java code and wiht comments thanks You are give the following interface...
1 Overview For this assignment you are required to write a Java program that plays (n, k)-tic-tac-toe; (n, k)-tic- tac-toe is played on a board of size n x n and to win the game a player needs to put k symbols on adjacent positions of the same row, column, or diagonal. The program will play against a human opponent. You will be given code for displaying the gameboard on the screen. 2 The Algorithm for Playing (n, k)-Tic-Tac-Toe The...
I need Help PLZ ( Java Code ).
Tomorrow 05.06.2019 I have to hand in my homework.
reachability
Actually, you find flying very good, but you do not
trust the whole new-fangled flying stuff and the infrastructure it
has built up. As a diehard medieval metal fan you prefer to travel
from A to B but rather the good old catapult. Since one can not
easily take the favorite cat on vacation with it (cats do not get
drafts, which...
I need Help PLZ ( Java Code ).
Today 14.06.2019 I have to hand in my homework.
reachability
Actually, you find flying very good, but you do not trust the
whole new-fangled flying stuff and the infrastructure it has built
up. As a diehard medieval metal fan you prefer to travel from A to
B but rather the good old catapult. Since one can not easily take
the favorite cat on vacation with it (cats do not get drafts, which...
Hello Guys. I need help with this its in java In this project you will implement a Java program that will print several shapes and patterns according to uses input. This program will allow the use to select the type (say, rectangle, triangle, or diamond), the size and the fill character for a shape. All operations will be performed based on the user input which will respond to a dynamic menu that will be presented. Specifically, the menu will guide...