Help With Data Structures (Singly Linked Lists)

Need help inserting user entered name alphabetically into SSL
import java.util.Scanner;
class SLLNode<T> {
    public T info;
    public SLLNode<T> next;
    public SLLNode() {
        next = null;
    public SLLNode(T el) {
        info = el; next = null;
    public SLLNode(T el, SLLNode<T> ptr) {
        info = el; next = ptr;
class SLL<T> {
    protected SLLNode<T> head, tail;
    public SLL() {
        head = tail = null;
    public boolean isEmpty() {
        return head == null;
    public void addToHead(T el) {
        head = new SLLNode<T>(el,head);
        if (tail == null)
            tail = head;
    public void addToTail(T el) {
        if (!isEmpty()) {
            tail.next = new SLLNode<T>(el);
            tail = tail.next;
        else head = tail = new SLLNode<T>(el);
    public T deleteFromHead() {
        if (isEmpty())
             return null;
        T el = head.info;
        if (head == tail)      
             head = tail = null;
        else head = head.next;
        return el;
    public T deleteFromTail() {
        if (isEmpty())
             return null;
        T el = tail.info;
        if (head == tail)     
             head = tail = null;
        else {                 
             SLLNode<T> tmp;   
             for (tmp = head; tmp.next != tail; tmp = tmp.next);
             tail = tmp;       
             tail.next = null;
        return el;
    public void delete(T el) { 
        if (!isEmpty())
            if (head == tail && el.equals(head.info))
                 head = tail = null;     
            else if (el.equals(head.info))
                 head = head.next;   
            else {                   
                 SLLNode<T> pred, tmp;
                 for (pred = head, tmp = head.next;
                      tmp != null && !tmp.info.equals(el);
                      pred = pred.next, tmp = tmp.next);
                 if (tmp != null) {  
                     pred.next = tmp.next;
                     if (tmp == tail)
                        tail = pred;
    public void printAll() {
        for (SLLNode<T> tmp = head; tmp != null; tmp = tmp.next)
            System.out.print(tmp.info + " ");
    public boolean isInList(T el) {
        SLLNode<T> tmp;
        for (tmp = head; tmp != null && !tmp.info.equals(el); tmp = tmp.next);
        return tmp != null;
class Passengers extends SLL<String>{
     Scanner kb = new Scanner (System.in);
     String name;
     Passengers(){
     void reserveTicket(){
          SLLNode<String> temp;
          System.out.println("Please enter your Last Name");
          name = kb.next();
          if(isEmpty())
               addToHead(name);
          else
               if(name.compareTo(head.info) <= 0)
                    addToHead(name);
               else
                    if(name.compareTo(head.info) > 0){
                         while(head.next == null){
                              temp = head.next;
                              name.compareTo(temp.info);
                                   if(name.compareTo(temp.info) <= 0)
                                        temp.info = name;
     void cancelReserve(){
          System.out.println("Please enter your Last Name");
          name = kb.next();
          if(isInList(name)){
               delete(name);
               System.out.println("Your reservation has safely been removed");
          else System.out.println("That reservation does not exist");
     void checkReserve(){
          System.out.println("Please enter your Last Name");
          name = kb.next();
          if(isInList(name)){
               System.out.println("You currently have a reservation for this flight");
               printAll();
          else System.out.println("Sorry, there is no reservation for this flight under that name");
     void showPassengers(){
          if(! isEmpty())
               printAll();
          else System.out.println("There are no passengers for this flight");
class Program2_19{
     public static void main(String[] a) {
          Passengers passList = new Passengers();
          Scanner kb = new Scanner (System.in);
          int choice;
          int option = 1;
          while(option == 1){
               System.out.println("Push 1 to Reserve a ticket");
               System.out.println("Push 2 to Cancel a reservation");
               System.out.println("Push 3 to Check reservations");
               System.out.println("Push 4 to Display all passengers");
               choice = kb.nextInt();
               System.out.println();
               if(choice == 1)
                    passList.reserveTicket();
               else if(choice == 2)
                    passList.cancelReserve();
               else if(choice == 3)
                    passList.checkReserve();
               else
                    passList.showPassengers();
          System.out.println("Would you like to perform another action?");
          System.out.println("Press 1 for yes, or 2 for no");
          option = kb.nextInt();
          System.out.println();
}

how do i step thru my list to find the correct spot to insert the name...I kno it has to be done with compareTo() but what do i compare the name with?..the node?.. the head? the tail?

Similar Messages

  • Help with creating a doubly linked list

    So I have been working with this file our teacher gave us, which is his own "list" ADT which I posted below (with out the comments so it doesn't stretch the page for ever)
    My question is, I cant really creat a DLL from this because I have nothing for the head, no previous or next or any of that...So could some one help me get off to the right start? Some of my class mates were like "create a SLL and then reverse it" well thats all fine and dandy but how?
    A couple other student said "With this DLL i only had to write two lines for each method to implement the list"...Can that be done? Theres NO documentation any where on a DLL for java, and the linkedList in the java api...I dont think that's a DLL...
    I SERIOUSLY need a nudge in the right direction....
    package assignment.four.utilities;
    import java.io.Serializable;
    public interface List<E> extends Serializable
         public int size ();
         public void clear ();
         public boolean add (int index, E toAdd) throws NullPointerException,
                                                                     IndexOutOfBoundsException;
         public boolean add (E toAdd) throws NullPointerException;
         public boolean addAll (List<? extends E> toAdd) throws NullPointerException;
         public E get (int index) throws IndexOutOfBoundsException;
         public E remove (int index) throws IndexOutOfBoundsException;
         public E remove (E toRemove) throws NullPointerException;
         public E set (int index, E toChange) throws NullPointerException,
                                                                IndexOutOfBoundsException;
         public boolean isEmpty ();
         public boolean contains (E toFind) throws NullPointerException;
         public E [] toArray (E [] toHold) throws NullPointerException;
         public E [] toArray ();
         public Iterator<E> iterator ();     
    }Again with my statement. Using that List ADT HOW do you even get started in the right direction to creating a DLL? I can use this to create an array list but i dont think i can for a dll?
    Edited by: user8974754 on Nov 20, 2010 8:00 PM

    user8974754 wrote:
    Ok thats fine and dandy but we never learned how to make a DLL we learned last semester how to make a SLL and I kinda get that but again with the So, you know how to make an SLL? Then I would suggest starting with that. For instance, you know how to define a Node or Element or whatever-you-want-to-call-it class that holds Data and Next? Start with that, and see if you can work out how to add a Previous.
    "there's nothing on DLL's" except for the same line over and over "They go backwards and forwards" and Im sorry but that doesn't cut it......So, [url http://www.youtube.com/watch?v=Ijae2WHdc9I]you know how to count blocks, but you don't know how to count oranges? That is, you know how to make forward links in a list, but not backward links? Really?
    Is there any examples of Java Dlls implementing lists and bla?I'm sure there are plenty, and I'm sure your google works as well as mine.
    like we cant implement any thing else as far as I know, it can only be this list....When I said you need to implement the various pieces, I meant in the normal English sense of the word, not in the Java keyword sense. Implementing a Node in the general sense is part of "implements List" in the Java keyword sense.
    I know the asking for a sample implementation might be considered cheating in some peoples books Yup.
    but i learn best from examples, explanations and what not...There's a world of difference between an example of a different use of the concepts that you're trying to learn and just doing your work for you. Whatever concepts this lesson is teaching that are being tested and reinforced by this homework, you can find plenty of examples without somebody providing a DLL implementation for you.
    Edited by: Am I still jverd? on Nov 20, 2010 9:05 PM

  • Need help with Data Structures!

    I'm finally in Java 2nd year! I'm working on a problem- have been working for hours but cant seem to get the hang for it. Basically after determining that an integer is odd, and not more than 10- we are supposed to print it this way
        1
                 333
              55555
           7777777
        999999999 This is what I've done so far!
    public class Numbers {
               public  static int print (int x) {
             String [] L = new String [x.length];
           if (x <= 1) {
            return x;
            else if  (x >= 10 ||  x% 2 != 1)
             System.out.println("Number is greater than 10");
            else
            for (int i = 0;  i < L.length; i ++) {
            System.out.println(x);
            return print (x -2);
          now when I run this program my output is
    9
    9
    9
    9
    9
    9
    9
    9
    7
    7
    7
    7
    7
    7
    7
    and so on untill
    1.
    I cant figure out which approach to take next. Tips please!

    it doesnt matter, I made it unrecursive, Ill just fix ur code up here:
    public class Numbers
    public  static int print (int x)
    if (x <= 1)      
    return x;       
    else if  (x >= 10)                 
    System.out.println("Number is greater than 10");
    else if ( x% 2 != 1)    
    System.out.println("Number is even"); 
    else
    int p = print(x-2);
    for (int i = 0;  i < x; i ++)
    System.out.print(x);       
    System.out.println();           
    return p;
    }

  • Sorting singly linked list with minimum time complexity

    Hi ...
    anyone could tell me how can i sort singly linked list with minimum time complexity .... ????
    Regards...

    By MergeSort or QuickSort O(n log n). But then you
    have to first extract the objects in the list,sort
    them, then rebuild the list. But it will still bealot
    faster than by keeping the list linked.Technically, I believe insertion sort is marginally
    faster for small n ( <20 or so).Woohoo! So for 20 out of the possible 2147483648 array
    sizes Insetion is faster!
    Unfortunately, checking for that case probably wastes
    all the time you get from using the faster sort...
    That would depend on the actual distribution off array sizes. So it's an engineering decision.
    Sylvia.

  • Changing data in a linked list object.

    hi,
    i'm still pretty new to java, so bear with me if i am making stupid mistakes, heh.
    i'm having trouble with changing data in an object stored in a singly-linked list. i've created a class that will store polynomials in sorted order (descending) in a singly-linked list. each linked list is one polynomial, and each node references to a polynomial object that stores two ints: the coefficient and the exponent of that term.
    i'm having trouble when it comes to 'collecting like terms,' though. here's a rough skeleton of my code:
    public class Polynomial
    private LinkedList polynoList;
    private LinkedListItr Itr;
    private int coeff;
    private int exponent;
    public Polynomial()
    zeroPolynomial();
    } // this constructor sets up an empty linked list
    public Polynomial( int c, int e )
    coeff = c;
    exponent = e;
    } // this creates a Polynomial object storing the two ints
    public void zeroPolynomial()
    polynoList = new LinkedList();
    theItr = polynoList.zeroth();
    } // this method creates the empty linked list and sets the
    //iterator on the zeroth node.
    //various other methods are here, not relevant to my post
    //this next method is the one i am having trouble with.
    //it takes two ints as parameters, the coefficient
    //and the exponent.
    public void insertTerm( int c, int e )
    //...i have a few if/then statements here
    //so that the terms can be inserted in descending order.
    LinkedListItr tester = polynoList.first();
    //the 'tester' iterator is set on the first node
    //this following if statement retrieves the exponent
    //in the current node by casting the information
    //retrieved from the LinkedList retrieve() method
    //into Polynomial, then compares it to the current
    //exponent. if they are equal, i want to add the
    //coefficients.
    if( e == ((Polynomial)tester.retrieve()).getExp() )
    this.coeff = ((Polynomial)tester.retrieve()).getCoeff() + c;
    //a main method goes here wherein the user can insert
    //terms, print the polynomial, etc.
    }//end Polynomial class
    can anyone help me out? the code i'm using compiles correctly, but it does not change the value of the current coeff variable as i'd like to think it should. any input would be GREATLY appreciated, thanks!

    hey,
    thanks for the reply...
    i am sure that ((Polynomial)tester.retrieve()).getExp() will return an int equal to 'e.' i tried this:
    System.out.println("e="+e);
    System.out.println((Polynomial)tester.retrieve()).getExp());
    if( e == ((Polynomial)tester.retrieve()).getExp() ){
    this.coeff = ((Polynomial)tester.retrieve()).getCoeff() + c;
    System.out.println( "this.coeff = " + this.coeff );
    with that, the output showed that e and the getExp() output were the same. it also showed (as output) that this.coeff did change in value, but when i tried this:
    System.out.println( ((Polynomial)tester.retrieve()).getCoeff() )
    to check if the value changed within the object, it didn't. this.coeff changed, but the actual coeff variable in the object didn't.
    any ideas?

  • How to add different data types in Linked list?

    The basic idea is that I want to implement a linked list like the one which we generally implement in C. I need to store different data types in a single node. Is it possible to implement like this or I have to implement a linked list for each different data type?

    I have an application program in which there is a form. In this form there are different text fields in which data is to be inserted by the user. These data's will be inserted into the database. I want to hit the database only once. So I need to store these data in a data structure before I insert into the database. I think it will be easy for me to handle the data in a linked list if I can have different data types in a single node.
    Moreover, I think u're not getting my question. This pic will help u.
    http://img522.imageshack.us/img522/4500/sampler.jpg
    I'm not sure about that the code which u have written will have different data types in single node. I have to try that.
    And of course if anyone has any better idea than me, it will be very helpful.

  • Is there a Java utility class to help with data management in a desktop UI?

    Is there a Java utility class to help with data management in a desktop UI?
    I am writing a UI to configure a network device that will be connected to the serial port of the computer while it is being configured. There is no web server or database for my application. The UI has a large number of fields (50+) spread across 16 tabs. I will write the UI in Java FX. It should run inside the browser when launched, and issue commands to the network device through the serial port. A UI has several input fields spread across tabs and one single Submit button. If a field is edited, and the submit button clicked, it issues a command and sends the new datum to the device, retrieves current value and any errors. so if input field has bad data, it is indicated for example, the field has a red border.
    Is there a standard design pattern or Java utility class to accomplish the frequently encountered, 'generic' parts of this scenario? lazy loading, submitting only what fields changed, displaying what fields have errors etc. (I dont want to reinvent the wheel if it is already there). Otherwise I can write such a class and share it back here if it is useful.
    someone recommended JGoodies Bindings for Swing - will this work well and in FX?

    Many thanks for the reply.
    In the servlet create an Arraylist and in th efor
    loop put the insances of the csqabean in this
    ArrayList. Exit the for loop and then add the
    ArrayList as an attribute to the session.I am making the use of Vector and did the same thing as u mentioned.I am using scriplets...
    >
    In the jsp retrieve the array list from the session
    and in a for loop step through the ArrayList
    retrieving each CourseSectionQABean and displaying.
    You can do this in a scriptlet but should also check
    out the jstl tags.I am able to remove this problem.Thanks again for the suggestion.
    AS

  • Why LinkedList uses doubly linked list and not single link list

    Hi,
    Please help me to understand the concept behind java using doubly linked list for LinkedList and not single link list?
    Edited by: user4933866 on Jun 26, 2012 11:22 AM
    Edited by: user4933866 on Jun 26, 2012 11:25 AM
    Edited by: EJP on 27/06/2012 08:50: corrected title to agree with question

    EJP wrote:
    Could you help me with one real world use case where we need to traverse linklist and arraylist in backward direction other than printing the linklist or arraylist in reverse order. One example is that you might want to use it as a stack. For a very large (+very+ large) stack it would out-perform the Vector-based Stack in the API.The first thing that pops into my head is an undo/redo function for a text editor. Each edit action is dumped onto such a stack. Each time you hit CTRL+Z to undo an action you go back in the stack. Each time you hit CTRL+Y to redo the action you go forward again.

  • Single Linked List

    Hi Guys,
    I am trying to create a single linked list with one node pointing to the other. Then I have to create a method that displays the contents of the nodes. This method must take the head of the linked list as a parameter.
    I have created a class called node to store the data of each node created: This is the class;
    public class Node {
        String data;
        Node next;
        public Node(String data) {
            setData(data);
            setNext(null);
        } // Constructor
        public void setData(String data) {
            this.data = data;
        public void setNext(Node next) {
            this.next = next;
        public String getData() {
            return data;
        public Node getNext() {
            return next;
        public String toString() {
            if(data == null)
                return "Node: null";
                else
                return "Node: " + data.toString();
    }The second class is LinkedList which initialises each node and creates the linked list.
    public class LinkedList {
        private Node head;
        public LinkedList() {
            setHead(null);
        } // constructor
        private void setHead(Node head) {
            this.head = head;
        } // setHead
        private Node getHead() {
             return head;
        } // getHead
        public void add(String data) {
            if(getHead() == null){
                Node temp = new Node(data);
                temp.setNext(getHead());
                setHead(temp);
            else
                add(getHead(), data);
        } // add
        public static void main (String args[]){
            Node n1 = new Node();
            n1.setData("Jane");
            if (getHead() == null){
                setHead(n1);
            }else{
            System.out.println ("No initialisation of Linked List");
            n1.setNext(n2);
            Node n2 = new Node();
            n2.setNext(n3);
            n2.setData("Maria");
            Node n3 = new Node();
            n3.setNext(n4);
            n3.setData("Paul");
            Node n4 = new Node();
            n4.setData("Charlene");
    }Am I on the right track? And how can I create the method to display all the nodes which takes the head of the list as a parameter only?
    Thanks a lot

    doobybug wrote:
    The code I posted compiled.Then pls fix me errors:
    LinkedList.java:24: add(java.lang.String) in LinkedList cannot be applied to (Node,java.lang.String)
                add(getHead(), data);
                ^
    LinkedList.java:29: cannot find symbol
    symbol  : constructor Node()
    location: class Node
            Node n1 = new Node();
                      ^
    LinkedList.java:31: non-static method getHead() cannot be referenced from a static context
            if (getHead() == null){
                ^
    LinkedList.java:32: non-static method setHead(Node) cannot be referenced from a static context
                setHead(n1);
                ^
    LinkedList.java:35: cannot find symbol
    symbol  : variable n2
    location: class LinkedList
                n1.setNext(n2);
                           ^
    LinkedList.java:36: cannot find symbol
    symbol  : constructor Node()
    location: class Node
                Node n2 = new Node();
                          ^
    \LinkedList.java:37: cannot find symbol
    symbol  : variable n3
    location: class LinkedList
                n2.setNext(n3);
                           ^
    LinkedList.java:39: cannot find symbol
    symbol  : constructor Node()
    location: class Node
                Node n3 = new Node();
                          ^
    LinkedList.java:40: cannot find symbol
    symbol  : variable n4
    location: class LinkedList
                n3.setNext(n4);
                           ^
    LinkedList.java:42: cannot find symbol
    symbol  : constructor Node()
    location: class Node
                Node n4 = new Node();
                          ^
    10 errors

  • Need Help with Dates

    I am printing a calendar and certain events will be helds on certain dates.
    One can edit the event if it has not passed the date. Events in the past can be viewed but not edited.
    When I query the database the date must be formatted dd-MMM-yy
    I am able to get today's date by doing this:
    java.util.Date today = new java.util.Date();
    String formatString = "dd-MMM-yy";
    SimpleDateFormat sdf = new SimpleDateFormat(formatString);
    String today_str = sdf.format(today);
    My code for printing the calendar: I left out some of the table formatting in the JSP page.
    GregorianCalendar d = new GregorianCalendar();
    int today = d.get(Calendar.DAY_OF_MONTH);
    int month = d.get(Calendar.MONTH);
    d.set(Calendar.DAY_OF_MONTH,1);
    int weekday = d.get(Calendar.DAY_OF_WEEK);
    for(int i = Calendar.SUNDAY; i < weekday; i++)
    out.print("<td> </td>");
    do {
    int day = d.get(Calendar.DAY_OF_MONTH);
    out.print("<td>" + day + "</td>");
    String formatString = "dd-MMM-yy";
    SimpleDateFormat sdf = new SimpleDateFormat(formatString);
    //if(event exists on this day
    // Get results
    // print link for viewing
    // if (after today) print link for edit
    if(weekday == Calendar.SATURDAY)
    out.println("</tr><tr valign=top>");
    d.add(Calendar.DAY_OF_MONTH,1);
    weekday = d.get(Calendar.DAY_OF_WEEK);
    } while(d.get(Calendar.MONTH) == month);
    if(weekday != Calendar.SUNDAY)
    System.out.println();
    The part I need help on is this:
    //if(event exists on this day
    // Get results
    // print link for viewing
    // if (after today) print link for edit
    I'm looping through each day of the month to print the days. I have the month, day, year as integers. How can I create a date object out of that and compare it to today's date to test if it's before or after today???
    All the function in the Date class that I think would do this have been deprecated.

    Need Help with Dates
    Here is some information about dates:
    There are many edible palm fruits, and one of the most widespread and favored of these is the data (Phoenix dactylifera). Dates were cultivated in ancient land from Mesopotamia to prehistoric Egypt, possibly as early as 6000 B.C. Then--as now--dates were a staple for the natives of those dry regions. Much later, Arabs spread dates around northern Africa, and dates were introduced into California by the Spaniards in 1765, around Mission San Ignacio.
    The date prefers dry, hot climates, because date fruits are injured at temperatures of 20 degrees F, and the damp climate of the California coast was not favorable for fruit production. In the mid-1800s, the date industry developed in California's hot interior valleys and in Arizona. Now the date industry in the United States is localized mostly in the Coachella Valley, where the sandy soils permit the plants to be deeply irrigated. Today the new varieties, mostly introduced in this century, produce about 40 million pounds of dates per annum, or over 60% of the dates consumed in this country. The rest are imported mainly from Persia. According to one survey, about one million people are engaged entirely in date palm cultivation worldwide.
    Hope that helps.

  • Need Help with data type conversion

    Hello People,
    I am new to java, i need some help with data type conversion:
    I have variable(string) storing IP Address
    IPAddr="10.10.103.10"
    I have to call a library function which passes IP Address and does something and returns me a value.
    The problem I have is that external function call in this library excepts IP Address in form of a byte array.
    Here is the syntax for the function I am calling through my program
    int createDevice (byte[] ipAddress).
    now my problem is I don't know how to convert the string  IPAddr variable into a byte[] ipAddress to pass it through method.

    Class InetAddress has a method
    byte[]      getAddress() You can create an instance using the static method getByName() providing the IP address string as argument.

  • I need help with event structure. I am trying to feed the index of the array, the index can vary from 0 to 7. Based on the logic ouput of a comparison, the index buffer should increment ?

    I need help with event structure.
    I am trying to feed the index of the array, the index number can vary from 0 to 7.
    Based on the logic ouput of a comparison, the index buffer should increment
    or decrement every time the output of comparsion changes(event change). I guess I need to use event structure?
    (My event code doesn't execute when there is an  event at its input /comparator changes its boolean state.
    Anyone coded on similar lines? Any ideas appreciated.
    Thanks in advance!

    You don't need an Event Structure, a simple State Machine would be more appropriate.
    There are many examples of State Machines within this forum.
    RayR

  • Help with date validation on input boxes.

    I need some help with date validation on input boxes.
    What I�m trying to create is a form where a user inputs dates and then the rest of the form calculates the other dates for them.
    i.e. � A user inputs 2 dates (A & B) and then a 3rd date which is 11 weeks before date B is calculated automatically.
    Is this possible and if so how do I do it ???
    Thanks

    Hi,
    to get third date try this:
    java.util.Date bDate = ...;
    Calendar yourCalendar = new GregorianCalendar();
    yourCalendar.setTime(bDate);
    yourCalendar.roll(Calendar.WEEK_OF_YEAR, -11);
    java.util.Date cDate = yourCalendar.getTime();Regards
    Ldinka

  • (Data Structures) Position (in Lists) ...simple - Urgent help needed!!!

    I know that Position is the abstract data type and that it supports only one method - element() (that returns the element stored in this position).. Now when I wish to implement a List (with doubly linked list) using the Interface List...In the Interface List there are quite few methods to implement , however, few of them require Position parameter...And this is where I am getting confused..What is the Position parameter? A number? or? Here is a sample code
    //Node class for implementing a Doubly linked list
    Class DoublyNode implements Position
    { public DoublyNode prev, next;
    public Object element
    //constructor
    public Dnode()
    { prev = null
    next = null
    element = null
    public Object element(){
    return element;
    Class NodeList implements List{
    // bunch of methods and variables
    public Position before(Position p) // What is Position parameter? a position number? or what?
    { DoublyNode v = (DoublyNode)p;
    DoublyNode prev = v.prev;
    return prev;
    Now I know since DoublyNode implements Position, we can cast a position to a node, but what is that Position parameter? Can anybody explain this minor detail to me? Or how do these Position parameters work in programing? All I know is, given a position parameter (what ?) the Doubly linked list will instantly locate the appropriate node (how) and you can cast it to a node and return the node...but how does this Position work?
    I am aware of the fact that everytime you insert in the list , that inserted element gets a position (a number?) how do I refer/catch back that node ? Via position (number)?
    Please Help....
    I appreciate it a lot!!!

    There's no standard Java class called Position, at least none that has anything to do with lists or collections. So this must be a class or interface that somebody else wrote. At any rate, a Position parameter needs a Position object, obvious as that may sound. How do you create a Position object? Somebody with documentation of the Position class or interface might be able to help here -- is this homework?

  • Need help with date and time calculations please

    Hello there.. Im stuck, and im hoping someone can help..
    Working on a list to manage and track PTO.  User completes PTO request form,
    Fields
    Name
    Start Date (with time)
    End Date (with time)
    Total Number of Days/hours requested: (calculation)
    Full Day: (Yes/No)
    ok business need
    user has the ability to request a certain number of hours as opposed to a full day.
    After searching around on google. I found this calculation to help me figure out how many BUSINESS days being requested.
    =IF(ISERROR(DATEDIF([Start Date],[End Date],"d")),"",(DATEDIF([Start Date],[End Date],"d"))+1-INT(DATEDIF([Start Date],[End Date],"d")/7)*2-IF((WEEKDAY([End Date])-WEEKDAY([Start Date]))<0,2,0)-IF(OR(AND(WEEKDAY([End
    Date])=7,WEEKDAY([Start Date])=7),AND(WEEKDAY([End Date])=1,WEEKDAY([Start Date])=1)),1,0)-IF(AND(WEEKDAY([Start Date])=1,(WEEKDAY([End Date])-WEEKDAY([Start Date]))>0),1,0)-IF(AND(NOT(WEEKDAY([Start Date])=7),WEEKDAY([End Date])=7),1,0))
    This works great as long as its a [Full Day]="YES", displays results in column labeled Number of days
    now if [Full Day]="No", displays results in column labeled Number of Hours
    BUT this is my issue (well part of it) it calcuate the correct number of hours.. but puts a "1" in "Number of Days" why.. dates have not changed.. I think Its something with the above calculation but I could be way off.
    the end result is I need number of days to concat with number of hours 
    i.e 1 full day 4 hours  1.4
        0 full day 5 hours  0.5
        1 full day 0 hours  1.0
    so that the total can be deducted via workflow.. from the remaining balance in a tracker. (seperate list) 
    Any angels out there??

    Posnera-
    Try changing time zones and see if the travel itinerary times change.
    Fred

Maybe you are looking for