Quantcast

Got Homework?

Connect with other students for help. It's a free community.

  • across
    MIT Grad Student
    Online now
  • laura*
    Helped 1,000 students
    Online now
  • Hero
    College Math Guru
    Online now

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

ajprincess

Can someone please help me?

  • one year ago
  • one year ago

  • This Question is Closed
  1. ajprincess
    Best Response
    You've already chosen the best response.
    Medals 0

    When I try to run java program in jdk1.7.0_07 I get an error message saying Main method not found in class Queue, please define the main method as public static void main(String[] args) I have defined t that way. I am unable to find the cause for this problem. Besides the same program runs perfectly in netbeans

    • one year ago
  2. slotema
    Best Response
    You've already chosen the best response.
    Medals 0

    Could you post Queue.java here?

    • one year ago
  3. ajprincess
    Best Response
    You've already chosen the best response.
    Medals 0

    Sure. It is actually Queue3.java import java.io.*; class Queue3 { private int maxSize; private char[] queueArr; private int front; private int rear; private int nItems; public Queue3(int s) { maxSize=s; queueArr=new char[maxSize]; front=0; rear=-1; nItems=0; } public void insert(char letter) { if(rear==maxSize-1) rear=-1; queueArr[++rear]=letter; nItems++; } public char remove() { char temp=queueArr[front++]; if(front==maxSize) front=0; nItems--; return temp; } public char peekFront() { return queueArr[front]; } public boolean isEmpty() { return (nItems==0); } public boolean isFull() { return (nItems==maxSize); } public int size() { return nItems; } } class QueueApp3 { public static void main(String[] args) throws IOException { BufferedReader keyboard = new BufferedReader (new InputStreamReader(System.in)); int a; int b; String c; int d; System.out.print("Enter the size of the array:"); a=Integer.parseInt(keyboard.readLine()); Queue3 theQueue=new Queue3(a); System.out.print("Enter the number of items to be inserted:"); b=Integer.parseInt(keyboard.readLine()); for(int i=1;i<=b;i++) { System.out.print("Enter the item:"); c=keyboard.readLine(); theQueue.insert(c.charAt(0)); } System.out.print("Enter the number of items to be removed:"); d=Integer.parseInt(keyboard.readLine()); for(int k=1;k<=d;k++) { theQueue.remove(); } System.out.print("Enter the number of items to be inserted:"); b=Integer.parseInt(keyboard.readLine()); for(int i=1;i<=b;i++) { System.out.print("Enter the item:"); c=keyboard.readLine(); theQueue.insert(c.charAt(0)); } while(!theQueue.isEmpty()) { char n=theQueue.remove(); System.out.print(n); System.out.print(" "); } System.out.println(" "); } }

    • one year ago
  4. ajprincess
    Best Response
    You've already chosen the best response.
    Medals 0

    It works nw. Thanx a lot for tryng to help me @slotema

    • one year ago
  5. slotema
    Best Response
    You've already chosen the best response.
    Medals 0

    And another job well done... Wait... I didn't do much ;) What was the problem?

    • one year ago
    • Attachments:

See more questions >>>

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.