Results 1 to 2 of 2
  1. #1
    passoa is offline Member
    Join Date
    Aug 2013
    Rep Power

    Question Help!! Schedual class with time and date

    I am in need of some help to solve a task but I have no clue how to do!!
    The task is to design and implement a class representing a schedule. It should be possible to add and remove moments and I can use ints to represent date and time, also it should be a method that checks that no moments collide, the method should not write anything but retur a boolean!
    Now this is how far I have gotten:
    Java Code:
    import java.util.ArrayList;
    public class Schema {
    private static final int MAX = 31;
    private ArrayList<Integer> numbers = new ArrayList<Integer>();
    private boolean okNumber(int i) {
    return i >= 0 && i <= MAX;
    public void add(int i) {
    if (okNumber(i) && !numbers.contains(i) ){
    public void delete(int i) {
    if (okNumber(i))
    numbers.remove((Integer) i);
    The problem is how to get the time in the class, i have no idéa and would be very happy for any help and code!!
    Last edited by passoa; 08-30-2013 at 02:41 PM.

  2. #2
    sehudson's Avatar
    sehudson is offline Senior Member
    Join Date
    Mar 2010
    Rep Power

    Default Re: Help!! Schedual class with time and date

    Think about it this way. Your goal is to create a class that represents a Schedule.
    How would you describe a Schedule, and what is it comprised of?
    This will help you to begin thinking about the attributes for your Schedule class and the best data structures to represent them.
    The Schema class that you have defined is only comprised of Integers that represent the day of the month.
    Java is object oriented, so just think about what makes up a schedule first, and that will help you to visualize the classes.
    That is the way that I would approach it. A Schedule is a collection of.......

Similar Threads

  1. Using Date() to get Start Time and Finish Time
    By dalythe in forum New To Java
    Replies: 4
    Last Post: 06-19-2013, 05:07 PM
  2. Replies: 18
    Last Post: 05-11-2011, 07:36 AM
  3. Date vs Time
    By mikerada6 in forum New To Java
    Replies: 1
    Last Post: 10-29-2010, 12:34 AM
  4. converting string (GMT date) to date in US time.
    By JRuyechan in forum New To Java
    Replies: 1
    Last Post: 10-15-2010, 07:07 AM
  5. Time and Date
    By Manfizy in forum New To Java
    Replies: 0
    Last Post: 05-27-2009, 12:58 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts