Assignment 2 Due 1012 - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

Assignment 2 Due 1012

Description:

adding to rt1 the precedences t8 t7 and t9 tt6, ... The user chooses a predecessor and a successor for each precedence and enters the precedence. ... – PowerPoint PPT presentation

Number of Views:69
Avg rating:3.0/5.0
Slides: 7
Provided by: leeab
Category:

less

Transcript and Presenter's Notes

Title: Assignment 2 Due 1012


1
Assignment 2Due 10/12
  • 2.a. Modify class RelatedTasks, by adding
  • a public boolean method ordered,
  • which takes an OrderedTasks, which is an ordering
    of its own tasks,
  • calls startCheck on each of its own tasks,
  • then goes through each of the tasks in the
    OrderedTasks checking whether it canBeNext, and
    if so notifying its successors,
  • if the OrderedTasks is consistent with the
    precedences, it returns true, else false

2
  • Demonstrate by
  • creating a RelatedTasks rt1,
  • creating and adding to rt1 a Task t5 with a
    taskNum of 5, a TimedTask tt6 with a taskNum of 6
    and a time of 16, a Task t7 with a taskNum of 7,
    a Task t8 with a taskNum of 8, a Task t9 with a
    taskNum of 9,
  • adding to rt1 the precedences t8 lt t7 and t9 lt
    tt6,
  • creating OrderedTasks with t8,t5,t9,tt6,t7 and
    with t5,t8,t7,tt6,t9, and for each test and print
    out whether they are ordered

3
  • 2.b. Modify class RelatedTasks, by adding a
    public method order, which returns an
    OrderedTasks,
  • it creates a clone tempTasks of its tasks
  • then successively
  • finds a task that canBeNext,
  • removes it from tempTasks,
  • puts it in the OrderedTasks to be returned,
  • and notifies its successors
  • until tempTasks isEmpty
  • Demonstrate by calling order on rt1 from 4.a. and
    printing the returned OrderedTasks
  • NOTE Vector offers removeElement(Object),
    isEmpty()

4
  • 2.c. Create a Window-Based Event-Driven
    Application
  • The GUI should have
  • a TextField for instructions
  • a TextField for entering task numbers
  • a Button for done entering tasks
  • a Choice list for choosing a predecessor
  • a Choice list for choosing a successor
  • a Button for entering a precedence
  • a Button for done entering precedences
  • a TextArea for displaying an ordering

5
  • The application should use Task, OrderedTasks,
    OrderedTasksEnum, and RelatedTasks
  • The user first enters some task numbers.
  • The application creates the tasks.
  • These task numbers are used to populate the two
    choice lists.
  • The user chooses a predecessor and a successor
    for each precedence and enters the precedence.

6
  • When the user is done entering precedences, the
    application then outputs one ordering of the
    tasks that is consistent with the precedences.
  • Instructions should guide the user through this
    process.
  • Demonstrate the program by entering the tasks
    5,4,3,2,1 in that order,
  • entering the precedences 3lt5,1lt4,2lt3 in that
    order, and capture the
  • frame when the ordering is displayed.
  • HINT Keep a Vector of handles to Tasks in the
    app, so it can call addPrecedence, based on on
    the indices of the choices
Write a Comment
User Comments (0)
About PowerShow.com