Results 1 to 5 of 5
  1. #1
    beginnerprog is offline Member
    Join Date
    Mar 2013
    Posts
    22
    Rep Power
    0

    Default Really confused on how to solve this problem need feedback and guidance

    ok so what im trying to do is to solve this problem
    View Places– The user selects a destination and the system displays all available Places at that destination. If there are no Places for a destination it should display a message to say so.

    Add Place– Allows the user to add Place(s) for a given destination. This should add to the list of existing Placesfor that destination (if there are any). For example, the system might ask how many Places I wish to add; I might enter 2; and then I might add "tesco" and "asda". I do not know how to put the added hotels into the view hotel method :S

    Im really confused on how to solve this problem. What i think i should do is to create two different methods for both problems. Whether i should use arrays and user can be asked to input Places which are stored in arrays.
    below is what i have tryed. Would appreciate some help. UPDATE this is what ive tryed but i think its the wrong way to go about it. im wo :

    Java Code:
    import java.util.*;
    
    public class placeMethods
    {
    public static void main(String[] args) 
    	{
    	addplace();
    	
    	}
    
    	public static void viewplace() 
    	{
    		String[] destination = new String[5];
    				destination[0] = "1: New York";
    				destination[1] = "2: Dahab";
    				destination[2] = "3: Rome";
    				destination[3] = "4: Sydney";
    				destination[4] = "5: Tokyo";
    				
    				int j;
    				for (j=0; j <destination.length; j++) //loop below is used to display the string of array
    				{ 
    				System.out.println(destination[j]);
    				}
    				System.out.println("Please select a Destination!");
    				
    				
    	}
    	
    	public static void addplace()
    	{	
    		
    		String[] destination = new String[5];
    				destination[0] = "1: New York";
    				destination[1] = "2: Dahab";
    				destination[2] = "3: Rome";
    				destination[3] = "4: Sydney";
    				destination[4] = "5: Tokyo";
    				
    				int j;
    				for (j=0; j <destination.length; j++) //loop below is used to display the string of array
    				{ 
    					System.out.println(destination[j]);
    				}
    				System.out.println("Please select a Destination!");
    				
    				
    				 
    				Scanner selectDestination = new Scanner(System.in);
    		        String inputDestination = selectDestination.nextLine();
    				String month;
    				if (inputDestination.equals("1"))
    				{
    				System.out.println("How many places do you wish to add?");
    				Scanner selectplace = new Scanner(System.in);
    				String inputNumber = selectplace.nextLine();
    					if (inputNumber.equals("1"))
    					{
    					System.out.println("Please enter the name of the place.");
    					addPlace = selectplace.next();
    					List list = new ArrayList();
    					list.add(addPlace);
    					System.out.println(list);
    					}	
    	
    				}
    		}		
    		
    	
    	}
    Last edited by beginnerprog; 03-25-2013 at 07:20 PM.

  2. #2
    milkman88 is offline Member
    Join Date
    Mar 2013
    Posts
    1
    Rep Power
    0

    Default Re: Really confused on how to solve this problem need feedback and guidance

    Have you tried breaking your class up into two different transforming spinner devices? If not, check that out. Also, I would not use arrays, I rather use something along the lines of bing bang sockets or mega lists.

  3. #3
    beginnerprog is offline Member
    Join Date
    Mar 2013
    Posts
    22
    Rep Power
    0

    Default Re: Really confused on how to solve this problem need feedback and guidance

    Quote Originally Posted by milkman88 View Post
    Have you tried breaking your class up into two different transforming spinner devices? If not, check that out. Also, I would not use arrays, I rather use something along the lines of bing bang sockets or mega lists.
    I have no idea what that stuff is. Ive only been taught beginner content so i am expected to use beginner stuff :(

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is online now Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,302
    Rep Power
    20

    Default Re: Really confused on how to solve this problem need feedback and guidance

    Please go through the Forum Rules, particularly the third paragraph.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    beginnerprog is offline Member
    Join Date
    Mar 2013
    Posts
    22
    Rep Power
    0

    Default Re: Really confused on how to solve this problem need feedback and guidance

    Quote Originally Posted by DarrylBurke View Post
    Please go through the Forum Rules, particularly the third paragraph.

    db
    Yes my title is really unhelpful but I really couldn't think of a better title. Also Im not asking anyone to program for me just need a direction

Similar Threads

  1. cant solve my problem .needs some help(C++):(y):
    By seongchog in forum New To Java
    Replies: 2
    Last Post: 12-03-2011, 08:49 PM
  2. Problem that I can't solve...
    By Wing.Sham in forum New To Java
    Replies: 9
    Last Post: 11-16-2011, 01:31 AM
  3. Could someone help me to solve this problem...
    By Vinny in forum Java Software
    Replies: 1
    Last Post: 07-08-2009, 06:59 PM
  4. Help me to solve problem
    By mansoorhacker in forum New To Java
    Replies: 3
    Last Post: 11-13-2008, 08:15 AM
  5. Replies: 3
    Last Post: 07-30-2007, 07:11 AM

Posting Permissions

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