Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Lab Assignment 2 - ISBN-10 CSCI 251 Problem Statement An ISBN (International Standard Book Number) consists of 10 digits: di d2 d3 d4 ds de
Lab Assignment 2 - ISBN-10 CSCI 251 Problem Statement An ISBN (International Standard Book Number) consists of 10 digits: di d2 d3 d4 ds de d dedg d1o. The last digit dio is a checksum, which is calculated from the other nine digits using the following formula where mod is short for modulus. If the checksum is 10, then the last digit is denoted X according to the ISBN convention. Any other number (i.e., 1 through 9) is the same number Write a program that prompts the user to enter the first 9 digits of an ISBN and then displays the 10-digit ISBN (including leading zeroes) Input Data nine digits of ISBN, character string Output Data . The 10 digit ISBN, correctly formatted as d, - d2d3- ddsdgdyddg dto Before You Begin 1. Start MATLAB (Start > All Programs > MATLAB R2014a) and change your Current Folder to the location of your hard drive (e.g., K:/MATLAB programs/) If you forget to do this, your MATLAB programs will not be accessible whenever the computers in this lab are cleared, which is throughout the semester 2. In the Command Window, type edit isbn10.m MATLAB should prompt that the file does not currently exist, select OK so MATLAB will create the file in your Current Folder Starting File Include header comments (i.e., at the beginning of your file) formatted as show below. Your electronic submission of the program file will represent your endorsement of the Honor Code Statement % CSCI 251, Section X 96 Jane Doe % Student ID 12345678 % Lab Assignment 2 % Due % In keeping with the Honor Code of the School of Engineering, I have neither % given nor received assistance from anyone other than the instructor Algorithm 1. Begin your program with clc clear 2. Prompt (ask) the user for the first 9 ISBN digits, using Matlab's input command. Note that this is 3. Determine if the length entered is 9 using an if-statement and the character length function. If 4. If the length is exactly 9, parse off each character into nine variables. For example to clear the Command Window and Workspace windows, respectively just one prompt (hint: use a character string) the input is anything other than length 9, output an error and your program is done d9 = str2num(isbn(9)) will parse off the last digit, convert it to a numeric value, and assign that value to d9
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started