CS205 First Programming Assignment
Due: Feb. 9 before class (5pm)

Dr. Kris Stewart (stewart@rohan.sdsu.edu)
San Diego State University


This URL is http://www.stewart.cs.sdsu.edu/cs205/firstassign.html

Write a MATLAB M-file script with the name

firstio.m
to accomplish the following tasks involving user input and output (I/O):
  1. Use the MATLAB input command to ask the user to enter a number in the range between 0 and 5.
  2. Use the MATLAB disp command to write a message thanking the user for input.
  3. Use a single MATLAB fprintf to write the number entered by the user with an appropriate text message (of your choosing) on the same line and, on a separate line, the number entered in fixed point (%f) format.
Use pico or vi for text editing to create the file in your CS205 class account.

NOTE: From lab on Jan. 28, you have a example of a MATLAB M-file script (page17.m) which you can examine. This is a file which contained MATLAB instructions and comments.

Comments are REQUIRED in your assignment and should identify the author of the program, give a brief summary of the task being accomplished. Following our test's 5 step problem solving methodology, be sure to test your solution well. Comments begin with the percent sign (%) followed by text and are one line long each and should be the first lines of your file.

Submission of your program: From you class account in CS205, there is a directory created for you named "turnin". This is in a location that the instructor will be able to run her tests. It is important that you follow the instructions carefully below and we can look in detail during lab (BA113) on Wednesday, Feb. 4, 1998, if there are any questions.

  1. Copy your file to the turnin directory. The following UNIX command will accomplish this
    % cp firstio.m ~/turnin

  2. Send email to the instructor telling me that your program is ready to be checked.
NOTE: there is at least one space between firstio.m and the tilde (~) above.