Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone tell me why this code won't work. I am using the IntelliJ Java language. Here is the code: package com.learn; import org.w3c.dom.ls.LSOutput; import

Can someone tell me why this code won't work. I am using the IntelliJ Java language.

Here is the code:

package com.learn; import org.w3c.dom.ls.LSOutput; import java.util.Queue; import java.util.LinkedList; import java.util.Stack; import java.util.ArrayList; public class Main { public static void main(String[] args) { } public static class QWP { public void main(String args[]){ QWP qp=new QWP(); qp.start(); } public void start(){ int orderup=234; Queue customers =new LinkedList (); customers.add(new Customer("Jim",234)); //printQueue(customers); Customer x=new Customer("Bob",999); customers.add(new Customer("Kaitlyn",123)); customers.add(new Customer("Jesse",432)); customers.add(new Customer("Andrea",476)); customers.add(x); printQueue(customers); Customer temp=customers.peek(); if(temp.ordernumber==orderup){ customers.remove(); } printQueue(customers); orderup=123; temp=customers.peek(); if(temp.ordernumber==orderup){ customers.remove(); } printQueue(customers); } public void printQueue(Queue q){ for(Customer i:q){ System.out.println(i.name+":"+i.ordernumber); } System.out.println("------");} } } class Customer { String name; int ordernumber; public Customer(String n, int o){ name=n; ordernumber=o; } 

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions