473,323 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

Table Class help

I am writting an address book which store name and address.
I've written a Node class with Get and Set method of String key and String value
I've also written a Main class for the menu to promt user input and call method from Node clasas and insert to table class.

I am in the process of writting this table class. However, I am stuck at the the other method, can someone help?
Here is my code:

public class Table
{
//constructor
public Table (String name, String address)
{
this.name=key;
this.address=value;
}
private Node head=null;

//Insert a new entry. If an entry already exiss with the given key value, make no inserton but return false.
public boolean insert (String key, String value)
{
//insearting a new node at the beginning of the list
Node pointer=head;
while (pointer!=key.equals(pointer.getkey()))
{
pointer=pointer.getNext();
}
if (pointer=null)
{
Node n = new Node ();//create a node to hold string
n.setNext(head);//link to head of the list
head=n;
}
}

//Look up an existing entry with the given key and returns the associated value. If no entry is found null is returned
public String lookUp (String key)
{
Node pointer=head;
while ((pointer !=null && !key.equals(pointer.getkey())))
{
pointer=pointer.getNext();
}
//name was found or not found.
if (pointer!=null)
return pointer.getvalue();
else
return null;
}
}

//Delete an existing entry with the given key. If no entry is found returns false.
public boolean delete (String key)
{


}

//update an existing entry. Update the old value with the new value associated with the given key
public boolean update (String key, String newValue)
{

}

//Set mark to the first entry of the table, return false when table is empty
public boolean markToStart()
{

}

//move mark to the next item in the table. If there is no next item, return false
public boolean advanceMark()
{

}

//returns the key stored in the item at the current mark
public String keyAtMark()
{

}

//returns the value in the item at the current mark
public String valueAtMark()
{

}

Thanks!
Oct 1 '07 #1
0 1209

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Don Grover | last post by:
I have a table thats wrapped in a div tag, that when user selects 1 of 2 radio buttons it hides or shows table, this works ok. But I want to set the table show hide on what the existing state of...
3
by: gg77 | last post by:
Hi, I don't have much knowledge of the table control. I am basically trying to use a table thats populated with data rows from a dataSet but currently things aren't working for me. below is...
1
by: Ryan Kaskel | last post by:
Hi! I am new to this newsgroup and need help implementing a hash table. This assignment is for school but only concerns one method. Basically we have to write methods like put(), get(),...
4
by: Amy | last post by:
I need some help. I have this table with alternate row colors. Class gray and class white. I have javascript that do highlight when mouseover row ... and onclick to select row and highlight it...
16
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record...
2
by: nino9stars | last post by:
Hello, I have just started messing with absolute positioning on webpages, and it definitely let's you do some creative things. Well, after much searching and help, I got the images I was using...
7
by: Kamal | last post by:
Hello all, I have a very simple html table with collapsible rows and sorting capabilities. The collapsible row is hidden with css rule (display:none). When one clicks in the left of the...
1
by: MissMarie | last post by:
I've been playing around with DIV tables in myspace to better learn how to rewrite my own code for my business site without having to pay someone to design it. I've tried embedding a slideshow into...
1
crystal2005
by: crystal2005 | last post by:
Hi i encounterd some problem when i implement CSS for rounded Corner table. Need help please... :D <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />...
9
by: vozzek | last post by:
Hi all, This has been haunting me for over 2 hours now, and I can't understand what's wrong with it. My shopping cart table's format is misaligned, and I have no clue why. Please help! Here's...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.