Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 1 of 1

Thread: A look and feel job scheduler that loops into date ranges and its job dependencies. Having difficulty in dates ranges and list.

  1. #1
    Junior Member marksquall's Avatar
    Join Date
    Jan 2009
    Posts
    27
    My Mood
    Fine
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default A look and feel job scheduler that loops into date ranges and its job dependencies. Having difficulty in dates ranges and list.

    Dear members and administrators:

    Hello to all. Hope/pray all is well.

    We have an assignment in which we need to develop a Java console application which acts like a job scheduler. A Job has an id, start date and end date, name, and list of dependent jobs. This is what I’d done so far:

    public class MyJob {
     
    	private String name;
    	private int jobId;
    	private LocalDate dtStart;
    	private LocalDate dtEnd;
     
    	public MyJob(int jobId, LocalDate dtStart, LocalDate endDate, String name){
    		this.jobId 	= jobId;
    		this.dtStart= dtStart;
    		this.dtEnd	= dtEnd;
    		this.name	= name;
     
    	}
     
    	public int getJobId(){
    		return jobId;
    	}
     
    	public String getJobName(){
    		return name;
    	}
     
    	public LocalDate getJobStartDate(){
    		return dtStart;
    	}
     
    	public LocalDate getJobEndDate(){
    		return dtEnd;
     
    	}
     
            public List<Integer> getJobDependencies(){
                 //no implementation yet, I am having diffuculty in this
            }
     
    	@Override
    	public String toString() {
    		return getTaskId() 		+ "\t\t\t" +
    			   getJobStartDate() 	+ "\t\t" +
    			   getJobEndDate()	+ "\t\t\t" +
    			   getJobName();
    	}
     
    }


    Here’s the objective of the program that I’d already resolved:
    1. Create three instance of MyJobs class and initialize the String “First job”, “second job” and “third job” each. This MUST be the correct order. (NOTE: I'd already resolved this task, using array of MyJobs and array of String, used for loop).



    Here’s some of the objectives that I want to ask for anyone’s help:
    1. Assign random job id to each of the jobs (EDIT: I'd already resolved this task, using random, and list, and put it in a loop together with instantiation of MyJob class).
    2. Within the start date and end date (example start date starts at January 1, 2019 and ends in January 31, 2019), assign random date range with a minimum of either 4 days or a max of 30 days, on the three Jobs.
    3. Create a list that serves as a dependent jobs.



    Example output I have so far (Please don't mind the HTML code, I just enclosed it using Wrap [HTML] tags around selected text:

    HTML Code:
    Job id		start date	end date	job name	dependencies
    101		2019-01-01	2019-01-31	first job
    109		2019-01-01	2019-01-31	second job
    103		2019-01-01	2019-01-31	third job

    Example output I would like to have (Please don't mind the HTML code, I just enclosed it using Wrap [HTML] tags around selected text:

    HTML Code:
    Job id		start date	end date	job name	dependencies
    101		2019-01-01	2019-01-04	first job
    109		2019-04-01	2019-01-15	second job	101
    103		2019-01-15	2019-01-31	third job	101, 109

    According to our instructor:

    1. The job id may, or may not be, in correct order as long as the job name is in order.
    2. As with the dependencies, you can see job id 103 should have dependencies of 101 and 109, because the program “should not” do third job as long as first job and second job are "not yet" finished.
    3. Jobs can start at the same date, and may, or may not finished on the same date too.
    4. Assign second job to be the longest days of all jobs in the output.


    I am currently working on the other objectives as the time of this writing, seems I am stuck with the date and dependencies. Also trying to used recursion, but I do not know how to end the recursive call.

    I hope someone could give me an idea how to resolved the remaining tasks.

    Thank you.

    Warmest regards,

    Mark
    Last edited by marksquall; April 14th, 2019 at 10:29 PM. Reason: Checked grammar.

Similar Threads

  1. What Are My First Steps to a First Job?
    By Yelp Review in forum The Cafe
    Replies: 0
    Last Post: May 30th, 2018, 11:33 AM
  2. First job!
    By ChristopherLowe in forum Totally Off Topic
    Replies: 3
    Last Post: December 5th, 2013, 11:56 AM
  3. Random Numbe rGame: Displaying ranges on console
    By inflames098 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 5th, 2012, 12:46 PM
  4. How to perform search for a value in table ranges : FROM - TO
    By jsimha in forum Loops & Control Statements
    Replies: 1
    Last Post: August 25th, 2012, 08:41 AM
  5. I need to make cases in a switch statement over certain ranges
    By davis220 in forum Java Theory & Questions
    Replies: 2
    Last Post: March 20th, 2012, 10:14 PM