HW6: Regarding output

1 view
Skip to first unread message

Neha

unread,
Dec 2, 2010, 2:13:36 AM12/2/10
to COSC2320
Hi,

In case you are trying to check out a book that is already checked out
what would be the expected output?

for example, if the instructions are
INSERT 10 "Data structures and algorithms"
CHECKOUT 10
CHECKOUT 10

what should be the output of the second checkout?

Justin Scott

unread,
Dec 2, 2010, 5:41:11 AM12/2/10
to COSC2320

ahmad qawasmeh

unread,
Dec 2, 2010, 11:10:20 AM12/2/10
to cosc...@googlegroups.com
Hi,
 
We won't check this. We may try to check out a book that hasn't been inserted at all in the hash table. In this case, the output syntax should be notfound.
 
Ahmad

Ted Spradley

unread,
Dec 2, 2010, 4:12:37 PM12/2/10
to cosc...@googlegroups.com
Hi,
 
So I know you won't check the case of trying to check out a book that is already checked, but that is one
of the possibilities for the checkOut function so we have to code for it.  We can't just leave that uncoded. 
 
So to repose the question:
 
If we are trying to check out a book that has a status of CHECKEDOUT,
should we output:
CHECKEDOUT
or
NOT FOUND
 
Thanks,
Ted
 
----- Original Message -----



No virus found in this incoming message.
Checked by AVG - www.avg.com
Version: 8.5.449 / Virus Database: 271.1.1/3292 - Release Date: 12/01/10 19:34:00

ahmad qawasmeh

unread,
Dec 2, 2010, 10:28:19 PM12/2/10
to cosc...@googlegroups.com
Hi,
 
If you are insistent, :) then just print out: notfound, because checkedout means that the process is successfull, but it is not in this case.
 
Regards,
Ahmad

Joe

unread,
Dec 2, 2010, 10:43:33 PM12/2/10
to COSC2320
Ahmad or Mario,
Is it possible to get the output for the example in the HW? Usually
the HW description provides us with an example of an input and its
output and I do not see it for this assignment (unless I am missing
something or confused)


Can we get the output for the given input:

INSERT 57 "Twenty Thousand Leagues Under the Sea"
INSERT 1000 "Julius Caesar"
INSERT 2014 "King Lear"
INSERT 170112 "Tom Swayer"
PRINT
CHECKOUT 1000
CHECKOUT 57
PRINT
RETURN 1
DELETE 2014
PRINT
DELETE 57
PRINT



Thank you.



On Dec 2, 9:28 pm, ahmad qawasmeh <arqawas...@gmail.com> wrote:
> Hi,
>
> If you are insistent, :) then just print out: notfound, because checkedout
> means that the process is successfull, but it is not in this case.
>
> Regards,
> Ahmad
> On Thu, Dec 2, 2010 at 4:12 PM, Ted Spradley <ted.sprad...@loansonline.us>wrote:
>
>
>
>
>
>
>
> >  Hi,
>
> > So I know you won't check the case of trying to check out a book that is
> > already checked, but that is one
> > of the possibilities for the checkOut function so we have to code for it.
> > We can't just leave that uncoded.
>
> > So to repose the question:
>
> > If we are trying to check out a book that has a status of CHECKEDOUT,
> > should we output:
> > CHECKEDOUT
> > or
> > NOT FOUND
>
> > Thanks,
> > Ted
>
> > ----- Original Message -----
>
> >   *From:* ahmad qawasmeh <arqawas...@gmail.com>
> > *To:* cosc...@googlegroups.com
> > *Sent:* Thursday, December 02, 2010 10:10 AM
> > *Subject:* Re: HW6: Regarding output
>
> > Hi,
>
> > We won't check this. We may try to check out a book that hasn't been
> > inserted at all in the hash table. In this case, the output syntax should be
> > notfound.
>
> > Ahmad
>
> > On Thu, Dec 2, 2010 at 2:13 AM, Neha <neha.agarwa...@gmail.com> wrote:
>
> >> Hi,
>
> >> In case you are trying to check out a book that is already checked out
> >> what would be the expected output?
>
> >> for example, if  the instructions are
> >> INSERT 10 "Data structures and algorithms"
> >> CHECKOUT 10
> >> CHECKOUT 10
>
> >> what should be the output of the second checkout?
>
> >  ------------------------------

ahmad qawasmeh

unread,
Dec 2, 2010, 10:54:17 PM12/2/10
to cosc...@googlegroups.com
Hi,
 
It is mentioned clearly in the HW description. For example, for insert:

Output Syntax:

< SUCCESSFUL|COLLISION|EXISTS > bucket <int>: book id <id>

for print,

BUCKET 0: <int> "<title>" AVAILABLE, <int> "<title>" CHECKEDOUT

BUCKET 1: <int> "<title>" AVAILABLE

BUCKET 2: empty

BUCKET 3: empty

BUCKET 0: <int> "<title>" AVAILABLE, <int> "<title>" CHECKEDOUT,<int> "title" AVAILABLE.

I think it is clear.

Regards,

Ahmad



Ted Spradley

unread,
Dec 3, 2010, 10:42:18 AM12/3/10
to cosc...@googlegroups.com, Josh Dixon
Thanks Ahmad.
 
Ok.  In the case of trying to check out a book that has a status of CHECKEDOUT,
we output:
NOT FOUND
 
One more question.  For all of us to have consistent output.
 
In the case of trying to return a book that has a status of AVAILABLE,
we output:
NOT FOUND
or
AVAILABLE?
 
Thanks,
Ted
 

Version: 8.5.449 / Virus Database: 271.1.1/3294 - Release Date: 12/03/10 07:34:00

Josh

unread,
Dec 3, 2010, 11:17:38 AM12/3/10
to COSC2320
what about the "BEGIN PRINT" and "END PRINT" lines? Should those be
output each time we print the bucket contents?

I know this is minor, but minor mistakes still get points
deducted. :)

Thanks,

Josh

On Dec 2, 9:54 pm, ahmad qawasmeh <arqawas...@gmail.com> wrote:
> Hi,
>
> It is mentioned clearly in the HW description. For example, for insert:
>
> Output Syntax: < SUCCESSFUL|COLLISION|EXISTS > bucket <int>: book id <id>
>
> for print,
>
> BUCKET 0: <int> "<title>" AVAILABLE, <int> "<title>" CHECKEDOUT
>
> BUCKET 1: <int> "<title>" AVAILABLE
>
> BUCKET 2: empty
>
> BUCKET 3: empty
>
> BUCKET 0: <int> "<title>" AVAILABLE, <int> "<title>" CHECKEDOUT,<int>
> "title" AVAILABLE.
>
> I think it is clear.
>
> Regards,
>
> Ahmad
>

Ted Spradley

unread,
Dec 3, 2010, 11:33:23 AM12/3/10
to cosc...@googlegroups.com
Hi again,
 
Another question:
 
The order of the list in each bucket.  When doing INSERT do you have a preference if the book is inserted at the head or the tail of the list?
 
Thanks, Ted

Ted Spradley

unread,
Dec 3, 2010, 11:35:00 AM12/3/10
to cosc...@googlegroups.com
Josh, I read the spec as those lines being included to be a delimiter for
the print output.

----- Original Message -----
From: "Josh" <jos...@gmail.com>
To: "COSC2320" <cosc...@googlegroups.com>
Sent: Friday, December 03, 2010 10:17 AM
Subject: Re: HW6: Regarding output

Thanks,

Josh


--------------------------------------------------------------------------------

No virus found in this incoming message.
Checked by AVG - www.avg.com

ahmad qawasmeh

unread,
Dec 3, 2010, 6:45:31 PM12/3/10
to cosc...@googlegroups.com
Hi,
 
Yes. The first book in the bucket should be the first which was inserted. I won't have cases to return a book that is available. Keep it available for your implementation. Let us also keep the status as checkedout if you want to checkout a book that has already been checked out. I think this is more logical. 
 
Regards,
Ahmad 

Ji Qing

unread,
Dec 3, 2010, 7:25:56 PM12/3/10
to cosc...@googlegroups.com
Ahmad,
 
keep the status as checkedout if you want to checkout a book that has already been checked out,
 
keep the status as available if you want to return a book that has already been returned,
 
 and we should output "NOTFOUND" for these two cases, right?
 
Thanks!

ahmad qawasmeh

unread,
Dec 4, 2010, 1:48:05 AM12/4/10
to cosc...@googlegroups.com
Hi,
 
What do you mean? You are contradicting yourself. As I said, If there is a command to checkout a book that has a checkedout status, then keep the status as it is (checkedout). If there is a command to return a book that has available status, then keep also the status as it is (available). 
 
Regards,
Ahmad

Lucas Hawk

unread,
Dec 4, 2010, 2:32:20 AM12/4/10
to cosc...@googlegroups.com, cosc...@googlegroups.com
He is not contradicting himself. He is asking about the output. 

If book 13 is checked out, and you send the command "checkout 13", what is the output? Is it the same as if the book was available? Regardless of the current state of the book (checkedout vs available) it should output "checkedout bookID"??

That's the question...

Sent from my iPhone

ahmad qawasmeh

unread,
Dec 4, 2010, 2:50:43 AM12/4/10
to cosc...@googlegroups.com
Hi,
 
I told you. If the status for book id 13 is checkedout and you have the command checkout 13. Output checkedout. In the case that there is a book with id 14 with a status available, and you have this command: return 14. Output available. I hope it is clear now.
 
Regards,
Ahmad

Ted Spradley

unread,
Dec 4, 2010, 12:48:32 PM12/4/10
to cosc...@googlegroups.com
Hi Ahmad,
 
I hate to bother you on this question.  Regarding output in the case of the command 'CHECKOUT 13' and bookID 13 already has a status of CHECKED out.  I think you have answered this question differently and I would like to clarify please.
 
Earlier in this thread I posted:
 
On Thu, Dec 2, 2010 at 4:12 PM, Ted Spradley <ted.sp...@loansonline.us> wrote:
Hi,
 
So I know you won't check the case of trying to check out a book that is already checked, but that is one
of the possibilities for the checkOut function so we have to code for it.  We can't just leave that uncoded. 
 
So to repose the question:
 
If we are trying to check out a book that has a status of CHECKEDOUT,
should we output:
CHECKEDOUT
or
NOT FOUND
 
Thanks,
Ted
 
You then repsonded:
"
----- Original Message -----
Sent: Thursday, December 02, 2010 9:28 PM
Subject: Re: HW6: Regarding output

Hi,
 
If you are insistent, :) then just print out: notfound, because checkedout means that the process is successfull, but it is not in this case.
 
Regards,
Ahmad
"
 
But, in the post immediately preceding this one you responded as highlighted.
 
To me these answers appear to conflict.  Your first answer of output 'NOTFOUND' seems logical since the operation did not result in a book being checked out successfully.  Your second answer just below could mean that you were tired. (understandable)
 
Could you point out for me if the answers do not conflict or if they do, then which output should we use please?
 
Thank you,
Ted S.

 
----- Original Message -----

ahmad qawasmeh

unread,
Dec 4, 2010, 1:59:38 PM12/4/10
to cosc...@googlegroups.com
Hi Ted,
 
Yes. At first, I told you something different, but I think it is more logical to keep the book as checkedout when you have a check out command for an already checkedout book. The same applies for return an available book. I think it is better to print out available. I am sorry about this, but as I told you, I think it is more logical. I appreciate your understanding and cooperation. Let me know if you have any more observations or concerns.
 
Regards,
Ahmad  

Joe

unread,
Dec 4, 2010, 2:04:02 PM12/4/10
to COSC2320
So I'm kind of confused now. You are saying "to keep the book as
checkedout" does that mean that's what you want us to cout or that's
what the status is going to be?

If you are returning a book that is already available what should the
output be?
If you are checking out a book that is already checked out.. Should
the output print "checked out" or "not found" when you try to check it
again?
The status of the book is obviously going to be listed as checked out
so should that be our output



On Dec 4, 12:59 pm, ahmad qawasmeh <arqawas...@gmail.com> wrote:
> Hi Ted,
>
> Yes. At first, I told you something different, but I think it is more
> logical to keep the book as checkedout when you have a check out command for
> an already checkedout book. The same applies for return an available book. I
> think it is better to print out available. I am sorry about this, but as I
> told you, I think it is more logical. I appreciate your understanding and
> cooperation. Let me know if you have any more observations or concerns.
>
> Regards,
> Ahmad
>
> On Sat, Dec 4, 2010 at 12:48 PM, Ted Spradley
> <ted.sprad...@loansonline.us>wrote:
>
>
>
>
>
>
>
> >  Hi Ahmad,
>
> > I hate to bother you on this question.  Regarding output in the case of the
> > command 'CHECKOUT 13' and bookID 13 already has a status of CHECKED out.  I
> > think you have answered this question differently and I would like to
> > clarify please.
>
> > Earlier in this thread I posted:
>
> >  On Thu, Dec 2, 2010 at 4:12 PM, Ted Spradley <ted.sprad...@loansonline.us
> > > wrote:
>
> >>  Hi,
>
> >> So I know you won't check the case of trying to check out a book that is
> >> already checked, but that is one
> >> of the possibilities for the checkOut function so we have to code for it.
> >> We can't just leave that uncoded.
>
> >> So to repose the question:
>
> >> If we are trying to check out a book that has a status of CHECKEDOUT,
> >> should we output:
> >> CHECKEDOUT
> >> or
> >> NOT FOUND
>
> >> Thanks,
> >> Ted
>
> >>  You then repsonded:
> >>  "
> >>  ----- Original Message -----
> >> *From:* ahmad qawasmeh <arqawas...@gmail.com>
> >> *To:* cosc...@googlegroups.com
> >>   *Sent:* Thursday, December 02, 2010 9:28 PM
> >> *Subject:* Re: HW6: Regarding output
>
> >> Hi,
>
> >> If you are insistent, :) then just print out: *notfound,* because
> >> checkedout means that the process is successfull, but it is not in this
> >> case.
>
> >> Regards,
> >> Ahmad
> >> "
>
> >   But, in the post immediately preceding this one you responded as
> > highlighted.
>
> >  To me these answers appear to conflict.  Your first answer of output
> > 'NOTFOUND' seems logical since the operation did not result in a book being
> > checked out successfully.  Your second answer just below could mean that you
> > were tired. (understandable)
>
> > Could you point out for me if the answers do not conflict or if they do,
> > then which output should we use please?
>
> > Thank you,
> > Ted S.
>
> > ----- Original Message -----
>
> >  *From:* ahmad qawasmeh <arqawas...@gmail.com>
> > *To:* cosc...@googlegroups.com
> >   *Sent:* Saturday, December 04, 2010 1:50 AM
> > *Subject:* Re: HW6: Regarding output
>
> > Hi,
>
> > I told you. If the status for book id 13 is checkedout and you have the
> > command checkout 13. Output *checkedout*. In the case that there is a
> > book with id 14 with a status available, and you have this command: return
> > 14. Output available. I hope it is clear now.
>
> > Regards,
> > Ahmad
>
> > On Sat, Dec 4, 2010 at 2:32 AM, Lucas Hawk <lukeh...@gmail.com> wrote:
>
> >>  He is not contradicting himself. He is asking about the output.
>
> >> If book 13 is checked out, and you send the command "checkout 13", what is
> >> the output? Is it the same as if the book was available? Regardless of the
> >> current state of the book (checkedout vs available) it should output
> >> "checkedout bookID"??
>
> >> That's the question...
>
> >> Sent from my iPhone
>
> >> On Dec 4, 2010, at 12:48 AM, ahmad qawasmeh <arqawas...@gmail.com> wrote:
>
> >>   Hi,
>
> >> What do you mean? You are contradicting yourself. As I said, If there is a
> >> command to checkout a book that has a checkedout status, then keep the
> >> status as it is (checkedout). If there is a command to return a book that
> >> has available status, then keep also the status as it is (available).
>
> >> Regards,
> >> Ahmad
>
> >> On Fri, Dec 3, 2010 at 7: 25 PM, Ji Qing <jiqingfut...@gmail.com> wrote:
>
> >>> Ahmad,
>
> >>> keep the status as checkedout if you want to checkout a book that has
> >>> already been checked out,
>
> >>> keep the status as available if you want to return a book that has
> >>> already been returned,
>
> >>>  and we should output "NOTFOUND" for these two cases, right?
>
> >>> Thanks!
>
> >>> On Fri, Dec 3, 2010 at 5:45 PM, ahmad qawasmeh <arqawas...@gmail.com>wrote:
>
> >>>> Hi,
>
> >>>> Yes. The first book in the bucket should be the first which was
> >>>> inserted. I won't have cases to return a book that is available. Keep it
> >>>> available for your implementation. Let us also keep the status as checkedout
> >>>> if you want to checkout a book that has already been checked out. I think
> >>>> this is more logical.
>
> >>>> Regards,
> >>>> Ahmad
>
> >>>>   On Fri, Dec 3, 2010 at 10:33 AM, Ted Spradley <
> >>>> ted.sprad...@loansonline.us> wrote:
>
> >>>>>  Hi again,
>
> >>>>> Another question:
>
> >>>>> The order of the list in each bucket.  When doing INSERT do you have a
> >>>>> preference if the book is inserted at the head or the tail of the list?
>
> >>>>> Thanks, Ted
>
> >>>>>  ----- Original Message -----
> >>>>> *From:* ahmad qawasmeh <arqawas...@gmail.com>
> >>>>> *To:* cosc...@googlegroups.com
> >>>>>   *Sent:* Thursday, December 02, 2010 9:28 PM
> >>>>> *Subject:* Re: HW6: Regarding output
>
> >>>>> Hi,
>
> >>>>> If you are insistent, :) then just print out: notfound, because
> >>>>> checkedout means that the process is successfull, but it is not in this
> >>>>> case.
>
> >>>>> Regards,
> >>>>> Ahmad
> >>>>> On Thu, Dec 2, 2010 at 4:12 PM, Ted Spradley <
> >>>>> ted.sprad...@loansonline.us> wrote:
>
> >>>>>>  Hi,
>
> >>>>>> So I know you won't check the case of trying to check out a book that
> >>>>>> is already checked, but that is one
> >>>>>> of the possibilities for the checkOut function so we have to code for
> >>>>>> it.  We can't just leave that uncoded.
>
> >>>>>> So to repose the question:
>
> >>>>>> If we are trying to check out a book that has a status of CHECKEDOUT,
> >>>>>> should we output:
> >>>>>> CHECKEDOUT
> >>>>>> or
> >>>>>> NOT FOUND
>
> >>>>>> Thanks,
> >>>>>> Ted
>
> >>>>>> ----- Original Message -----
>
> >>>>>>   *From:* ahmad qawasmeh <arqawas...@gmail.com>
> >>>>>> *To:* cosc...@googlegroups.com
> >>>>>> *Sent:* Thursday, December 02, 2010 10:10 AM
> >>>>>> *Subject:* Re: HW6: Regarding output
>
> >>>>>> Hi,
>
> >>>>>> We won't check this. We may try to check out a book that hasn't been
> >>>>>> inserted at all in the hash table. In this case, the output syntax should be
> >>>>>> notfound.
>
> >>>>>> Ahmad
>
> >>>>>> On Thu, Dec 2, 2010 at 2:13 AM, Neha <neha.agarwa...@gmail.com>wrote:
>
> >>>>>>> Hi,
>
> >>>>>>> In case you are trying to check out a book that is already checked
> >>>>>>> out
> >>>>>>> what would be the expected output?
>
> >>>>>>> for example, if  the instructions are
> >>>>>>> INSERT 10 "Data structures and algorithms"
> >>>>>>> CHECKOUT 10
> >>>>>>> CHECKOUT 10
>
> >>>>>>> what should be the output of the second checkout?
>
> >>>>>>  ------------------------------
>
> >>>>>> No virus found in this incoming message.
> >>>>>> Checked by AVG -www.avg.com
> >>>>>> Version: 8.5.449 / Virus Database: 271.1.1/3292 - Release Date:
> >>>>>> 12/01/10 19:34:00
>
> >>>>>   ------------------------------
>
> >>>>> No virus found in this incoming message.
> >>>>> Checked by AVG -www.avg.com
> >>>>> Version: 8.5.449 / Virus Database: 271.1.1/3294 - Release Date:
> >>>>> 12/03/10 07:34:00
>
> >  ------------------------------
>
> > No virus found in this incoming message.
> > Checked by AVG -www.avg.com

ahmad qawasmeh

unread,
Dec 4, 2010, 2:26:50 PM12/4/10
to cosc...@googlegroups.com
Hi,
 
Both. The status and the printing out.
The answer for question 1: available
The answer for question 2: checkedout
I hope you are not confused now.
 
Regards,
Ahmad

Joe

unread,
Dec 4, 2010, 5:45:29 PM12/4/10
to COSC2320
Thank you Ahmad!
Reply all
Reply to author
Forward
0 new messages