Unformatted text preview:

. .Fall 2009 CPE 101: Fundamentals of Computer Science I Zo¨e Wood. .Program 1: ISBN NumbersDue date: Friday, october 2, 11:59pm.1 PurposeTo write a program requiring use of variable declarations, reading values intoand writing the values stored in variables, assignment statements, conditionalstatements, simple math computations and printing output to console.Programming environment. This is a solo programming project. You areresponsible for all the work related to the program development, testing andsubmission.Collaboration. Any collaboration between peers, as well as any collabora-tion with outside sources is strictly prohibited. If you have any questions,concerning the assignment, please consult the instructor.2 Program DescriptionIn this project you will create a simple program to compute the ’checkSum’number used as the last digit in the ISBN numbering system.The International Standard Book Number (ISBN) is a unique, numericalcommercial book identifier, based upon the 9-digit Standard Book Numbering(SBN) code. These numbers can be found on most books. For example• 3-540-61545-8• 1-234-56789-XThe first nine digits are assigned by the publisher and the last symbol iscomputed from the previous digits and used as checkSum number to errors inISBN numbers. The last digit is computed as a weighted sum of the first 9digits as follows.• First sum the first digit and1• 2 times the second digit, plus• 3 times the third digit, plus• etc....• 9 times the ninth digit• Then compute the remainder of dividing the sum by 11.• If the remainder is less then 10, then the remainder becomes the checkSum;• otherwise the checkSum is the symbol ’X’3 Program SpecificationsWrite a small C program which prompts the user to input 9 individual numbersof the ISBN number. The program will then compute the checkSum and printout the entire ISBN number. All prompts and output should match the followingexamples word for word!The first output line shall contain the text "ISBN checkSum computationprogram"1. The first prompt shall bePlease enter the first digit of the ISBN number:The program shall read in the first digit of the ISBN number.2. The second prompt shall bePlease enter the second digit of the ISBN number:The program shall read in the next digit of the ISBN number.3. The third prompt shall bePlease enter the third digit of the ISBN number:The program shall read in the next digit of the ISBN number.4. Repeatedly prompt the user for all nine digits, with the final prompt beingPlease enter the ninth digit of the ISBN number:The program shall read in the ninth digit of the ISBN number.5. Your program will then compute the checkSum given the algorithm de-scription above and print out the final ISBN number. Output should beprinted as follows:ISBN is: x-xxx-xxxxx-xwhere ’x’ is replaced with appropriate values. After this line is printed,your program shall stop.2General NotesMath. You are responsible for the remainder of the program design for thisprogram. In particular, you are responsible for coming up with the correct mathto compute the outputs of the program based on the inputs.Program name. Name your program isbn.c.ANSI C. Your program shall be written in ANSI C. The instructor will com-pile your program using the following gcc flags:gcc -ansi -Wall -pedanticAny program that does not compile in this fashion will be assigned a score of 0.Style. Your code will checked for style. Your program shall conform to thestyle described athttp://users.csc.calpoly.edu/∼cstaley/General/CStyle.htmIn addition, the header comment shall include your name, the date, and onesentence describing the program. You must note in the header any errors inyour program.Any style violations are subject to an automatic 10% penalty.Testing. Please test your code on all available ISBN numbers you find athand. You will be provided with the instructor’s binary and with a set of testcases for testing your program. Both will be released to you at the beginningof next week. Once test cases become available to you, make sure you test yourcode against the instructor’s binary and ensure complete match of the outputs.Any program that fails any of the public tests will not receive more than 30%of the grade.4 Submission InstructionsSubmission.Files to submit. You shall submit the isbn.c file.Submission procedure. You will be using handin program to submit yourwork. The procedure is as follows:• ssh to vogon (vogon.csc.calpoly.edu).• Students shall execute the following submission command:> handin zwood csc101p1 isbn.cNote that you may submit your file more then once. Any later submissions,write over the previous submission and the latest time stamp is displayed.No late submissions are allowed!35 Sample OutputThe followings shows two different runs of the program with two different inputvalues> a.outISBN checkSum computation programPlease enter the first digit of the ISBN number: 1Please enter the second digit of the ISBN number: 2Please enter the third digit of the ISBN number: 3Please enter the fourth digit of the ISBN number: 4Please enter the fifth digit of the ISBN number: 5Please enter the sixth digit of the ISBN number: 6Please enter the seventh digit of the ISBN number: 7Please enter the eighth digit of the ISBN number: 8Please enter the ninth digit of the ISBN number: 9ISBN is: 1-234-56789-x> a.outISBN checkSum computation programPlease enter the first digit of the ISBN number: 3Please enter the second digit of the ISBN number: 5Please enter the third digit of the ISBN number: 4Please enter the fourth digit of the ISBN number: 0Please enter the fifth digit of the ISBN number: 6Please enter the sixth digit of the ISBN number: 1Please enter the seventh digit of the ISBN number: 5Please enter the eighth digit of the ISBN number: 4Please enter the ninth digit of the ISBN number: 5ISBN is:


View Full Document

Cal Poly CPE 101 - Program 1: ISBN Numbers

Documents in this Course
Load more
Download Program 1: ISBN Numbers
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Program 1: ISBN Numbers and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Program 1: ISBN Numbers 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?