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 3 of 3

Thread: Travel Agent

  1. #1
    Junior Member
    Join Date
    Feb 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Travel Agent

    Dear All, I brought a book to learn java progamming but unfortunately some of the answers are not in the book so I was wondering if anyone can quick help me out here and what the codes should look like. This is my firt post so pleace be nice.

    /**
     * Chapter 3: Excercise 2
     * An object of class LettingAgent maintains data and produces reports
     * useful in managing the business of a letting agent that arranges 
     * the rental of homes of various kinds with between 1 and 5 bedrooms.
     */
    import java.util.ArrayList;
    public class LettingAgent
    {
        /** NOTE: The following fields are essential, but NO MORE fields should be added */
        private String tradingName;  // Business name of the agent Ð to appear in printed reports
        private ArrayList<Home> available;  // To hold the homes currently available for rent
        private ArrayList<Home> let;        // To hold the homes currently let (rented out)
     
        /** Constructor to initialise a newly created LettingAgent object 
         *  The parameter supplies a business name for the agent.
         */
        public LettingAgent(String name)
        {
    [B]        /** Entre Code */[/B]
        }
     
        /** Method to add a home to the collection of those available to let.
         *  -- The number of bedrooms must be in the range 1 to 5.
         *  -- The specified address must be different from the address of any home already
         *     in the list of homes available for letting.
         *  If either condition is not satisfied, an error report should be printed.
         *  If the conditions are satisfied, the home is added to those available to let, 
         *  and a fully detailed confirmation is printed.
         */
        public void makeAvailable(String address, String kind, int bedrooms, int rent)
        {
    [B]        /** Entre Code */[/B]
        }
    Last edited by helloworld922; February 15th, 2010 at 12:07 PM.


  2. #2
    Junior Member
    Join Date
    Feb 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Travel Agent

    Sorry I do know the first obvious bit.
      public LettingAgent(String name)
        {
           tradingName = name; 
        }
    Last edited by helloworld922; February 15th, 2010 at 12:07 PM.

  3. #3
    Junior Member
    Join Date
    Feb 2010
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Travel Agent

    hey did any1 have any idea?