#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    3
    Rep Power
    0

    Conference Track Management


    I have a following requirement:
    Appreciate any help.

    CONFERENCE TRACK MANAGEMENT


    The conference has multiple tracks each of which has a morning and afternoon session.
    Each session contains multiple talks.
    Morning sessions begin at 9am and must finish by 12 noon, for lunch.
    Afternoon sessions begin at 1pm and must finish in time for the networking event.
    The networking event can start no earlier than 4:00 and no later than 5:00.
    No talk title has numbers in it.
    All talk lengths are either in minutes (not hours) or lightning (5 minutes).
    Presenters will be very punctual; there needs to be no gap between sessions.


    Test input:

    Writing Fast Tests Against Enterprise Rails 60min
    Overdoing it in Python 45min
    Lua for the Masses 30min
    Ruby Errors from Mismatched Gem Versions 45min
    Common Ruby Errors 45min
    Rails for Python Developers lightning
    Communicating Over Distance 60min
    Accounting-Driven Development 45min
    Woah 30min
    Sit Down and Write 30min
    Pair Programming vs Noise 45min
    Rails Magic 60min
    Ruby on Rails: Why We Should Move On 60min
    Clojure Ate Scala (on my project) 45min
    Programming in the Boondocks of Seattle 30min
    Ruby vs. Clojure for Back-End Development 30min
    Ruby on Rails Legacy App Maintenance 60min
    A World Without HackerNews 30min
    User Interface CSS in Rails Apps 30min

    Test output:

    Track 1:
    09:00AM Writing Fast Tests Against Enterprise Rails 60min
    10:00AM Overdoing it in Python 45min
    10:45AM Lua for the Masses 30min
    11:15AM Ruby Errors from Mismatched Gem Versions 45min
    12:00PM Lunch
    01:00PM Ruby on Rails: Why We Should Move On 60min
    02:00PM Common Ruby Errors 45min
    02:45PM Pair Programming vs Noise 45min
    03:30PM Programming in the Boondocks of Seattle 30min
    04:00PM Ruby vs. Clojure for Back-End Development 30min
    04:30PM User Interface CSS in Rails Apps 30min
    05:00PM Networking Event

    Track 2:
    09:00AM Communicating Over Distance 60min
    10:00AM Rails Magic 60min
    11:00AM Woah 30min
    11:30AM Sit Down and Write 30min
    12:00PM Lunch
    01:00PM Accounting-Driven Development 45min
    01:45PM Clojure Ate Scala (on my project) 45min
    02:30PM A World Without HackerNews 30min
    03:00PM Ruby on Rails Legacy App Maintenance 60min
    04:00PM Rails for Python Developers lightning
    05:00PM Networking Event
  2. #2
  3. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,719
    Rep Power
    348
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    3
    Rep Power
    0
    public class Test {
    public static void main(String[] args) {
    try{
    // Open the file that is the first command line parameter
    FileInputStream fstream = new FileInputStream("C:\\test.txt");

    // Get the object of DataInputStream
    DataInputStream in = new DataInputStream(fstream);

    BufferedReader br = new BufferedReader(new InputStreamReader(in));
    String timer, strLine;
    StringBuffer inputText = new StringBuffer();
    StringBuffer timeFrames = new StringBuffer();
    Map<String, String> mapper = new LinkedHashMap<String, String>();

    //Read File Line By Line
    while ((strLine = br.readLine()) != null) {
    inputText.append(strLine+"\n");
    if("lightning".equalsIgnoreCase(strLine.substring(strLine.lastIndexOf(" ")+1))){
    timeFrames.append("5min\n");
    timer = "5min";
    }else{
    timeFrames.append(strLine.substring(strLine.lastIndexOf(" ")+1)+"\n");
    timer = strLine.substring(strLine.lastIndexOf(" ")+1);
    }
    mapper.put(strLine, timer);
    }

    System.out.println("Input Text:");
    System.out.println(inputText);

    System.out.println("Time Frames");
    System.out.println(timeFrames);

    for (Map.Entry<String, String> entry : mapper.entrySet()) {
    System.out.println(entry.getValue()+" "+entry.getKey());
    }

    //Close the input stream
    in.close();
    }catch (Exception e){//Catch exception if any
    System.err.println("Error: " + e.getMessage());
    }
    }

    }

    test.txt:

    Writing Fast Tests Against Enterprise Rails 60min
    Overdoing it in Python 45min
    Lua for the Masses 30min
    Ruby Errors from Mismatched Gem Versions 45min
    Common Ruby Errors 45min
    Rails for Python Developers lightning
    Communicating Over Distance 60min
    Accounting-Driven Development 45min
    Woah 30min
    Sit Down and Write 30min
    Pair Programming vs Noise 45min
    Rails Magic 60min
    Ruby on Rails: Why We Should Move On 60min
    Clojure Ate Scala (on my project) 45min
    Programming in the Boondocks of Seattle 30min
    Ruby vs. Clojure for Back-End Development 30min
    Ruby on Rails Legacy App Maintenance 60min
    A World Without HackerNews 30min
    User Interface CSS in Rails Apps 30min
  6. #4
  7. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,719
    Rep Power
    348
    Please edit you post and wrap the code in code tags:

    [code]

    the code here

    [/code]

    Can you explain what problems you are having and ask some specific questions about the program?
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    3
    Rep Power
    0
    I am not getting the desired output for gven input.
  10. #6
  11. Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Aug 2010
    Location
    Eastern Florida
    Posts
    3,719
    Rep Power
    348
    Please edit you post and wrap the code in code tags.
    I am not getting the desired output
    Please post the current output and add some comments saying what is wrong with it.

IMN logo majestic logo threadwatch logo seochat tools logo