jQuery in Action, 3rd edition
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes recNo in Bodgitt and Scarper Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "recNo in Bodgitt and Scarper" Watch "recNo in Bodgitt and Scarper" New topic

recNo in Bodgitt and Scarper

Lek Olof

Joined: Jan 03, 2007
Posts: 10

I am doing the Bodgitt and Scarper assignment. My question is that recNo in the database interface seems to be a unique identifier for a record in the database.

But what is int recNo, what field does it correspond to in the database schema? The answer is so obvious that I cannot figure it out =)

Required Interface
Your data access class must be called "Data.java", must be in a package called "suncertify.db", and must implement the following interface:

package suncertify.db;
public interface DB
// Reads a record from the file. Returns an array where each
// element is a record value.
public String[] read(int recNo) throws RecordNotFoundException;
// Modifies the fields of a record. The new value for field n
// appears in data[n]. Throws SecurityException
// if the record is locked with a cookie other than lockCookie.
public void update(int recNo, String[] data, long lockCookie)
throws RecordNotFoundException, SecurityException;
// Deletes a record, making the record number and associated disk
// storage available for reuse.
// Throws SecurityException if the record is locked with a cookie
// other than lockCookie.
public void delete(int recNo, long lockCookie)

And the database schema:

The database that Bodgitt and Scarper uses contains the following fields:
Field descriptive name Database field name Field length Detailed description
Subcontractor Name name 32 The name of the subcontractor this record relates to.
City location 64 The locality in which this contractor works
Types of work performed specialties 64 Comma separated list of types of work this contractor can perform.
Number of staff in organization size 6 The number of workers available when this record is booked
Hourly charge rate 8 Charge per hour for the subcontractor. This field includes the currency symbol
Customer holding this record owner 8 The id value (an 8 digit number) of the customer who has booked this. Note that for this application, you should assume that customers and CSRs know their customer ids. The system you are writing does not interact with these numbers, rather it simply records them. If this field is all blanks, the record is available for sale.
Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
It corresponds to no record field in the database. You must come up with a way of mapping the record number (recnum = 0, 1, 2, ...) to the corresponding record in the file.

Ask a Meaningful Question and HowToAskQuestionsOnJavaRanch
Getting someone to think and try something out is much more useful than just telling them the answer.
Muhammad Shafique
Ranch Hand

Joined: Sep 30, 2006
Posts: 59
Shall we start physical record number from zero?
Lek Olof

Joined: Jan 03, 2007
Posts: 10
Barry -> thanks for the reply.

I understand what you mean. What seems strange to me is the following interface method decleration:

public String[] read(int recNo)

this method should be used by the GUI to retreive a record. But how can the search criteria be an int recNo??? The "only" search criteria should be some string with location, city etc or drop downs menus etc.

Barry Gaunt
Ranch Hand

Joined: Aug 03, 2002
Posts: 7729
Look at read() as an elementary operation on the database. read(i) simply gets you the i-th record. So, if you have to implement a find() operation for some criteria, then you have to read a bunch of records and select from them those that satisfy the criteria and discard the rest. Believe me, this thing is really primitive.
[ January 03, 2007: Message edited by: Barry Gaunt ]
I agree. Here's the link: http://aspose.com/file-tools
subject: recNo in Bodgitt and Scarper
It's not a secret anymore!