Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7634765
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T07:15:49+00:00 2026-05-31T07:15:49+00:00

Ok so I just posted a question and it was way too long so

  • 0

Ok so I just posted a question and it was way too long so nobody fully read it or tried to help so I deleted that and I’m going to make this question much more specific and less of a rambling story. I would just like some help troubleshooting a class in a java program.

Here’s what the class (This is one of 6 classes needed for this assignment) should do:

“Write a fully documented class named Queue that is a subclass of Vector (or any class of your choice). Your queue class should define operations for isEmpty, enqueue, dequeue and size*, along with a constructor that defines an empty queue. Read through the Java API documentation to find out which methods act the same as enqueue and dequeue. Remember that your queue will hold items of type Object.
*the “size” method simply returns the number of elements in the queue”

Here’s what I have written so far for this class:

import java.util.Vector;

    public class Queue extends Vector {

Vector<Object> line;

public Queue() {

}

public boolean isEmpty() {
    if (line.isEmpty())
        return true;
    else
        return false;
}

public void enqueue(Customer customer) {
    line.addElement(customer);
}

public void dequeue() {
    line.removeElementAt(0);
}

public int size() {
    return elementCount;
}

}

This is in the grading rubric:

Queue class defined correctly as a subclass of Vector by using “extends” and by using the
available Vector methods (Queue class should not have an instance of a Vector inside it). Any other class may be used instead of Vector. [10 points]

I have seen the vector api so please do not simply link me to it (no offense) because I’m still having trouble understanding this. Any help on what to do is greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T07:15:50+00:00Added an answer on May 31, 2026 at 7:15 am

    You are requested to write a new class called Queue

    1. with the methods isEmpty, enqueue, dequeue and size
    2. your class should extend Vector (or something else that is like a Vector)
    3. your class should use the methods of the extended class to implement the four required methods.

    For example:

    public class Queue extends Vector{
    
        // here you are implementing isEmpty
        public boolean isEmpty() {
            // ... by delegating to the method with the same name in the Vector class
            return super.isEmpty();
        }
    
        // ...
    
    }
    

    As documented, you should not have an instance of Vector in your class.

    As Jakub says, you will not have to implement methods that have the same name as the method in Vector (so go ahead and remove that isEmpty method). Where you will have to do some translation is, for example:

    public void enqueue(Object o) {
        // what method(s) could you use to simulate an enqueue of this object? 
        // Maybe `add(o)`?
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have posted this question on the Ext-GWT forums, I am just hoping that
I just posted this question: How to distribute my Java program so that it
I just posted this question jQuery - passing arrays in post request , where
I just posted a question about whether WPF is a good choice for a
I just posted this question and learned about <see cref=> , however when i
I've just posted a question on stackoverflow about a hide/show issue I was having
So I just have posted a question about this code (which was answered): $(document).ready(Main);
This question is related to another question I just posted . I'm prepping for
[I just posted a similar question, but I'm not sure whether is actually got
Can someone explain why the console acts this way? I posted this question once,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.