473,327 Members | 2,074 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,327 software developers and data experts.

Book Catalog Assignment

1
The book code would uniquely identify a book in a book catalog. The book code is a ten digits value, where the first nine digits must be decimal digits (0...9), and the tenth can be either a decimal digit or the letter X. Three single dashes may be between any of the characters. (That is, a book code may either have no dashes or exactly three dashes). Also, a book code must not begin or end with a dash.

What is a good way to start this?

Some examples of valid book codes are:
0-201-88337-6
0-13-117334-0
0821211315 (no dashes is ok)
1-57231-866-X

Some invalid book codes are:
0-201-8A337-6 (bad digit)
0-201-88337-63 (too many digits)
0-201-88-337-6 (too many dashes)
0-201883376 (not enough dashes)
-013-117334-0 (beginning or ending dash)
157231--866-X (sequential dashes)
013-1134-0 (too few digits)

I just dont know where to start.
Thanks
Mar 6 '07 #1
1 2075
The book code would uniquely identify a book in a book catalog. The book code is a ten digits value, where the first nine digits must be decimal digits (0...9), and the tenth can be either a decimal digit or the letter X. Three single dashes may be between any of the characters. (That is, a book code may either have no dashes or exactly three dashes). Also, a book code must not begin or end with a dash.

What is a good way to start this?

Some examples of valid book codes are:
0-201-88337-6
0-13-117334-0
0821211315 (no dashes is ok)
1-57231-866-X

Some invalid book codes are:
0-201-8A337-6 (bad digit)
0-201-88337-63 (too many digits)
0-201-88-337-6 (too many dashes)
0-201883376 (not enough dashes)
-013-117334-0 (beginning or ending dash)
157231--866-X (sequential dashes)
013-1134-0 (too few digits)

I just dont know where to start.
Thanks


I would start by doing special cases that handle the invalid exceptions

make the entering of the book code a string and use the string functions in <string.h>

also, you can use loops with string pointers as invariants to find the errors ( like not enough dashs, too many dashed, etc.)
Mar 6 '07 #2

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

Similar topics

3
by: christof hoeke | last post by:
hi, does anyone know about this book which sounds great? unfortunately i could not find anything more about it apart from the following entry at amazon (germany only, strange...) ...
7
by: tada991 | last post by:
Hello Everyone, I just purchased Visual Studio .Net Architect 2003 and want to know what's a good book for begginers to start with. I know nothing about programming whatsoever, but I do have a...
2
by: Robert S. Ramos | last post by:
I need help in selecting the best C# book for someone going from VB.NET to C#. I am in the process of looking for a new job and I have found an excellent company, problem is that I have only being...
13
by: YoVoltron | last post by:
I am just starting this "appointment book" java program and would appreciate some basis direction. I do not expect anyone to write the code for me but i would like opinions on how to best handle the...
6
by: nemo | last post by:
Hi, I'm looking for a good introductory book on ASP.Net for teaching undergraduates who know VB.Net but are not programmers as such. Last year I used "Programming ASP.Net" - second edition, by...
1
momotaro
by: momotaro | last post by:
You are to write a card catalog type definition. There are up to 1000 books, and for each one you need: Title A list of up to 5 authors Catalog number A list of up to 5 subject headings Status...
11
by: fishmonger1972 | last post by:
Hi! I'm a librarian with a little PHP knowledge.. I'm trying to make a catalog from scratch for my library. I don't like the look of the current catalog so I'm trying to make a custom PHP/MySQL...
15
by: dhr | last post by:
newbie question: Is there a 'K&R" type of Python book? The book that you'd better have on your shelf if you are going into Python?
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
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...
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...
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
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.