Results 1 to 3 of 3

Thread: String question

  1. #1
    kay19 is offline Member
    Join Date
    May 2013
    Posts
    11
    Rep Power
    0

    Default String question

    Hey, well I'm doing a StudentAdvisor java file f, and one of the method questions I am a bit stumped. Let me show you the question

    The AssignTable method removes a record from each queue and returns the pair of names as a single string. (Remember you can use the + operator
    to combine two strings.)

    Here is my code so far(Using Java Utility Classes).
    Java Code:
    public class StudentAdvising
    {
    	public static class Record
    	{
    		public String Student
    		
    		public Record(String name)
    		{
    			Student = name;
    		}
    		
    		public Record(Record Item)
    		{
    			Student = Item.student;
    		}
    		
    	public boolean QueueStudent(String name)
    	{
    		Record B = new Record(name);
    		WaitStudent.offer(B)
    	}
    	
    	public boolean QueueAdvisor(String name)
    	{
    		Record C = new Record(name);
    		WaitAdvisor.offer(C)
    	}
    	
    	public Record AssignTable()
    	{
    		Record B = WaitStudent.peek();
    		Record C = WaitAdvisor.peek();
    		WaitStudent.remove();
    	}
    	private java.util.LinkedList<Record> WaitStudent = new java.util.LinkedList<Record>();
    	private java util LinkedList<Record> WaitAdvisor = new java.util.LinkedList<Record>();
    Well I think i'm okay with the other two methods. However, not sure how to proceed with the method AssignTable(). Any help/feedback is appreciated.

  2. #2
    monkeyjr97 is offline Senior Member
    Join Date
    Nov 2012
    Posts
    258
    Rep Power
    2

    Default Re: String question

    you can iterator through each list, if Record.getStudent() is equal to the one you search for, remove it from the list and store it as a variable. Do this for both list then :

    String removed = removedFromWaitStudent + removedFromWaitAdvisor; (These variables are the Strings removed from each linked list.

  3. #3
    kay19 is offline Member
    Join Date
    May 2013
    Posts
    11
    Rep Power
    0

Similar Threads

  1. String split question
    By asai in forum New To Java
    Replies: 3
    Last Post: 04-09-2013, 04:30 PM
  2. String question
    By Blasz in forum New To Java
    Replies: 7
    Last Post: 09-16-2010, 02:55 PM
  3. String question
    By Raphy00 in forum New To Java
    Replies: 5
    Last Post: 05-12-2010, 08:53 AM
  4. JOptionPane String to int question
    By blackstormattack in forum New To Java
    Replies: 3
    Last Post: 03-08-2009, 12:14 AM
  5. question on string tokenizer
    By munigantipraveen in forum New To Java
    Replies: 2
    Last Post: 05-23-2008, 05:00 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
  •