[Solved] COMP1400 Lab3- Understanding expressions

$25

File Name: COMP1400_Lab3-_Understanding_expressions.zip
File Size: 376.8 KB

SKU: [Solved] COMP1400 Lab3- Understanding expressions Category: Tag:
5/5 - (1 vote)

An International Standard Book Number (ISBN) is a unique number assigned to each book. ISBN-10 has ten digits in 4 parts which the last digit is check digit. The check digit is base eleven, and can be 0-9 or X (instead of 10). To compute a missing check digit, each digit should be multiplied by its position in the number (counting from the right). Then, the sum of these products should

be divided by 11 to find the remainder. Finally, the check digit can be found by subtracting the remainder from 11.

For example, take the ISBN 0-201-53082-?:

  1. First calculate sum of products: 010 + 29 + 08 + 17 + 56 + 35 + 04 +

83 + 22 = 98

  1. Remainder upon dividing by 11 is 10.
  2. Remainder is subtracted from 11.
  3. Check digit is 1.

For more information, watch the following Youtube video about finding the missing check digit of an ISBN number https://www.youtube.com/watch?v=5qcrDnJg-98

Part A: RAPTOR Exercise

  1. Start RAPTOR and create a flowchart that asks the user to enter the first 9 digits of an ISBN-10, and displays the corresponding check digit.
  2. Run the flowchart with different numbers.
  3. Save the flowchart to a file named isbn.rap in the working directory on the PC you are using.
  4. Demonstrate the isbn.rap file to GA/TAs and run with different input values.

Part B: C Programming Exercise

  1. Implement the algorithm as represented by isbn.rap, and write an equivalent C program that accomplishes what the flowchart does. The program, however, is allowed to call the scanf() function only once. A sample interaction is shown below:

Enter the first nine digits of ISBN: 020153082 Check digit: 1

  1. Save your program to a file named isbn.c in the working directory on the PC you are using.
  2. Demonstrate the isbn.c file to GA/TAs and run with different input values.
  3. Hint: To read single digits, well use scanf with the %1d conversion specification.

EVALUATION:

You need to show your GA/TA the complete programs at the end of this lab, or at the beginning of your next lab. The marks you will receive for this lab are made of two parts: Lab work marks 10 and attendance marks 5. Total 15 marks.

Lab Work Mark: Your C code will be evaluated based on your solutions for the problems based on the following scheme:

  1. Does the code run and meet specifications?
    • Is input adequate and input data type properly validated?
    • Is processing adequate?
    • Is output correct and adequate?
    • Is the code compliable?
    • Is the code run properly?
  1. Is the code properly commented?
    • Is the program title, programmers first and last name, and the date posted at the top in a multi-line comment?
    • Is each significant step of the program properly commented?
    • Are comments added to clarify details?
    • Are comments clear, accurate, neatly formatted, and have no misspellings?
  1. Is the code properly formatted?
    • Are blocks of code indented according to their parent-child relationship?
    • Do curly braces line up vertically?
    • Is there an empty line between significant steps (blocks) of the program?
    • Is the width of the code contained within a reasonable limit so that minimal horizontal scrolling is required (with 800 x 600 monitor resolution), and there is minimal line-wrapping when printed?
    • Is camel-case notation used for variable, e.g. employeeLastName?

IMPORTANT:

ASK QUESTIONS IF YOU GET STUCK, BUT DO YOUR OWN CODE. ANY CODE SUSPECTED TO BE SIMILAR TO ANOTHER SUBMISSION WILL CAUSE BOTH SUBMISSIONS TO RECEIVE A ZERO MARK ON ALL LABS AND BE REPORTED FOR PLAGIARISM.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] COMP1400 Lab3- Understanding expressions
$25