class Item { String name ; float price ; Item( String nameP , float priceP ) { name=nameP ; price=priceP ; } } class Customer { String name ; int tableNo ; Customer( String nameP , int tableNoP ) { name=nameP ; tableNo=tableNoP ; } } class Order { Item item1 ; Item item2 ; Customer customerObject ; Order(Item item1P, Item item2P , Customer customerP ) { item1 = item1P ; item2 = item2P ; customerObject = customerP ; } public String toString() { String result = "First Item: " + item1.name ; result += "\nSecond Item: " + item2.name ; result += "\nFor Customer: " + customerObject.name ; result += "\nFor Table No: " + customerObject.tableNo ; return result ; } } public class Composition { public static void main( String args[] ) { Item item1 = new Item( "Burger" , 1.50f ) ; Item item2 = new Item( "Fries" , 1.00f ) ; Customer customer1 = new Customer( "Buster Douglas" , 4 ) ; Order orderObj = new Order(item1, item2, customer1 ) ; System.out.println( orderObj ) ; } //public static void main( String args[] ) }