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 8633569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:30:48+00:00 2026-06-12T09:30:48+00:00

I was asked to create a class that implement a queue of jobs using

  • 0

I was asked to create a class that implement a queue of jobs using Array List.
We can add jobs and runtime to the queue. A job runs from the front of the queue in the JobInQueue list, myPendingTime gets subtracted and the completed job goes to the Finishedjobs list.

It looks like we have to use boolean mutator method for this but I am not sure how to create this method.
could anyone tell me how to do this.

/**
  * runs the first job on the queue if there is enough time on the clock.
  */
public boolean runJob()
{
    boolean jobDone = runJob(); 
     if(myJobInQueue.isEmpty() && myDuration > myPendingTime){
       myDuration-= myPendingTime;
       myJobInQueue.remove(0);
       myFinishedJobs.add(myJobInQueue.get(0));
       System.out.println("The job runing is : "+ myJobInQueue.get(0));
       jobDone=true;
     }
    return jobDone ; 
}
  • 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-06-12T09:30:49+00:00Added an answer on June 12, 2026 at 9:30 am

    Based on your inputs, please find the updated program below:

      public void runJob(){
        boolean jobDone = false; 
        if(!myJobInQueue.isEmpty() && myDuration > myPendingTime){
             myDuration-= myPendingTime;
             myFinishedJobs.add(myJobInQueue.get(0));
             myJobInQueue.remove(0);
             System.out.println("The job runing is : "+ myJobInQueue.get(0));
            jobDone=true;
        }
        if(!jobDone ){
             runJob();
        } 
      }
    

    Also I believe you want to check, myJobInQueue is not empty i.e. if(!myJobInQueue.isEmpty() && myDuration > myPendingTime).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was asked to create a very simple dashboard using a Sharepoint list as
I was asked to create a bounded queue class to which the conditions were
So recently, I asked a question about a class I created that extended SQLiteOpenHelper
i have asked to create a module that will record video messages form the
I have been asked to create a vbscript that will set the default font
I’ve been asked to create a CSS (non-HTML5) based site that has a filled
I'm trying to create DatePicker dialog from a class that doesn't extends the Activity
I currently have a class that uses the KeyValuePair with List to store a
I would like to create a singleton class that is instantiated once in each
I have been asked to write a class that connects to a server, asynchronously

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.