# data[].attributes.body
import java.util.Scanner;
class Queue{
public int data;
public Queue next;
public Queue (){
}
}

class listQueue{
public Queue headptr, tailptr;

public void enqueue (){
Queue newptr = new Queue();
int value;
Scanner scan = new Scanner(System.in);
System.out.println ("Masukkan nilai: ");
value = scan.nextInt ();
newptr.data = value;
newptr.next = null;

if(tailptr==null && headptr==null){
tailptr = headptr = newptr;
}
else{
newptr.next = tailptr;
tailptr = newptr;
}
}
}

class Main{
public static void main (String args []){

listQueue LQ = new listQueue ();

LQ.enqueue();

}

# data[].attributes.body
import java.util.scanner;

class Queue{

public int Data;
public Queue Next;

//class for ListQueue

class ListQueue{

public Queue HeadPtr,TailPtr;

//class enqueue
public void nQueue() {
Queue newPtr=new Queue;
int value;
scanner scan=new scan(System.in);
system.out.println("Enter input:")
value=scan.nextInt();
newPtr.data=value;
newPtr.next=null;

if( headPtr==null && tailPtr==null);
headPtr=tailPtr=newPtr;

else{
newPtr.next=headPtr;
headPtr=tailPtr;
}
}

# data[].attributes.body
import java.util.Scanner;
//class Queue
class Queue{
public int data;
public Queue next;
public Queue(){
}
}
//class ListQueue
class ListQueue{
public Queue headptr;
public Queue tailptr;
// Enqueue
public void enqueue(){
Queue newptr= new Queue();
int value;
Scanner scan = new Scanner(System.in);
System.out.println("ENTER YOUR VALUE:");
value=scan.nextInt();
newptr.data= value;
newptr.next= null;
if(tailptr==null&&headptr==null){
tailptr=headptr=newptr;
} else
newptr.next=tailptr;
tailptr=newptr;

}
}
//Main
class Main{
public static void main(String args[]){
ListQueue Q=new ListQueue();
Q.enqueue();
}

# data[].attributes.body
import java.util.Scanner; class Queue{ public int data; public Queue next; } class ListQueue{ public Queue headptr, tailptr; public void Enqueue (){ Queue newptr = new Queue(); int value; Scanner scan = new Scanner(System.in); System.out.println ("Masukkan data baru: "); value = scan.nextInt (); newptr.data = value; newptr.next = null; if(tailptr==null && headptr==null) tailptr = headptr = newptr; else{ newptr.next = tailptr; tailptr = newptr; } } public void DisplayAll(){

# data[].attributes.body
import java.util.scanner;

class Queue{

public int Data;
public Queue Next;

//class for ListQueue

class ListQueue{

public Queue HeadPtr,TailPtr;

//class enqueue
public void nQueue() {
Queue newPtr=new Queue;
int value;
scanner scan=new scan(System.in);
system.out.println("Enter input:")
value=scan.nextInt();
newPtr.data=value;
newPtr.next=null;

if( headPtr==null && tailPtr==null);
headPtr=tailPtr=newPtr;

else{
newPtr.next=headPtr;
headPtr=tailPtr;
}
}

# data[].attributes.body
import java.util.scanner; class queue{ public int data; public queue next; } class queuelist{ public queue headptr,tailptr; public void enqueue (){ Queue newptr = new Queue(); int value; Scanner scan = new Scanner(System.in); System.out.println ("Enter value : "); value = scan.nextInt (); newptr.data = value; newptr.next = null; if(tailptr==null && headptr==null){ tailptr = headptr = newptr; } else{ newptr.next = tailptr; tailptr = newptr; } } }

// Main

class Main{
public static void main (String args []){

queuelist qL = new queuelist ();

qL.enqueue();

}

# data[].attributes.body
import java.util.scanner;

//class queue
class queue{

public int data;
public queue next;

//class ListQueue

class ListQueue{

public queue headPtr,tailPtr;

//class enqueue
public void enqueue() {
Queue newPtr=new Queue;
int value;
scanner scan=new scan(System.in);
system.out.println("sila masukan input:")
value=scan.nextInt();
newPtr.data=value;
newPtr.next=null;

if(tailPtr==null && headPtr==null);
tailPtr=headPtr=newPtr;

else{
newPtr.next=tailPtr;
tailPtr=headPtr;
}
}

//main class

class main {
public static void main (string args[]){

ListQueue LQ=new ListQueue();
LQ.enqueue(9);
LQ.enqueue(15);
LQ.enqueue(4);
LQ.enqueue(3);
LQ.displayAll();

# data[].attributes.body
//class Queue

import java.util.Scanner;
class Queue{
public int data;
public Queue next;
public Queue(){
}
}

//class list Queue

class listQueue{
public Queue headptr, tailptr;

public void enqueue(){
Queue newptr = new Queue();
int value;
Scanner sc = new Scanner(System.in);
System.out.println ("Enter the value:");
value = sc.nextInt();
newptr.data = value;
newptr.next = null;
if (tailptr == null && headptr == null){
tailptr = headptr = newptr;
}
else{
newptr.next = tailptr;
tailptr = newptr;
}
}
}

//main
class Main{
public static void main(String args[]){
listQueue K = new listQueue();
K.enqueue();
}
}

# data[].attributes.body
import java.util.Scanner;
class Queue{
public int data;
public Queue next;
public Queue (){
}
}

class listQueue{
public Queue headptr, tailptr;

public void enqueue (){
Queue newptr = new Queue();
int value;
Scanner scan = new Scanner(System.in);
System.out.println ("Masukkan nilai: ");
value = scan.nextInt ();
newptr.data = value;
newptr.next = null;

if(tailptr==null && headptr==null){
tailptr = headptr = newptr;
}
else{
newptr.next = tailptr;
tailptr = newptr;
}
}
}

class Main{
public static void main (String args []){

listQueue LQ = new listQueue ();

LQ.enqueue();

}

# data[].attributes.body
import java.util.Scanner;

class Queue{
public int data;
public Queue next;
}

class ListQueue{
public Queue headptr, tailptr;

public void enqueue(int value){
Queue newptr = new Queue();
// Scanner scan = new Scanner(System.in);
// System.out.println("Masukkan data baru :");
// int value = scan.nextInt();

newptr.data = value;
newptr.next = null;

if(headptr==null && tailptr==null)
headptr= tailptr= newptr;

else
{
newptr.next = tailptr;
tailptr= newptr;}

}

public void displayAll(){

Queue currptr;

currptr= tailptr;
while (currptr!=null){
System.out.println(currptr.data);
currptr=currptr.next;}}

public void dequeue(){
Queue currptr, prevptr;
currptr= prevptr= tailptr;
while(currptr!=headptr){
prevptr=currptr;
currptr=currptr.next;}

headptr=prevptr;
currptr=null;
headptr.next= null;
System.out.println("Proses Dequeue"+headptr.data);

}

}

class interfaceQueue{
public static void main(String args[]){

ListQueue Q = new ListQueue();
System.out.println("Proses Enqueue");
Q.enqueue(10);
Q.enqueue(15);
Q.enqueue(5);
Q.displayAll();

System.out.println("Proses Dequeue");
Q.dequeue();
Q.displayAll();

}
}