CS 135: Computer Science I
Spring 2008
There are many ways to write a program that meets a specification. In this part of the assignment, rewrite (re-design, re-implement, and test) the golf program from assignment three without using functions (4 points). Call your source file golfRedux.cpp. Note that we have posted a solution to assignment three on the class web page. Now answer the following questions (Type in your answers, handwritten answers will not be accepted):
We expect one or two paragraphs of writing to answer each of the Whys. For this part, in addition to source code and program output, make sure that you hand in the answers to these questions on a separate sheet of paper. Sample runs will look exactly like the ones for assignment three.
Red Blood Cells (RBCs) are the most common type of blood cell and the vertebrate body's principal means of delivering oxygen from the lungs or gills to body tissues via the blood. Figure 1 shows some. In a small drop of blood (
Now given an image like the one in Figure 2 below, we can use artificially intelligent computer vision techniques to count the number of RBCs seen through a microscope in the triple-lined square. Suppose Leandro Loss (one of our TAs), who does research in computer vision, has written a program that reads images like
Figure 2 and outputs a file with the following information in it:Here's an example: suppose the input file subject0.txt contains:
Smith male 32 58Then the patient Smith is an adult (over 18), male, with
sushil@xpc:~/samba/classes/135/assignments/as5/code$ ./rbc
Enter subject's filename
subject0.txt
---------------------------------------------------------------------------
Subject name: Smith
gender: male
age: 32
has: 5.8e+06 Red Blood Cells per micro litre of blood
Smith has a normal RBC count
sushil@xpc:~/samba/classes/135/assignments/as5/code$ ./rbc
Enter subject's filename
subject1.txt
---------------------------------------------------------------------------
Subject name: Melon
gender: female
age: 53
has: 1.66e+07 Red Blood Cells per micro litre of blood
Melon has polycythemia
sushil@xpc:~/samba/classes/135/assignments/as5/code$ ./rbc
Enter subject's filename
subject20.txt
Error in opening file: subject20.txt
Exiting....
subject0.txt and subject1.txt are linked from the class web page.
Always check for errors when opening input and output files. We suggest ensuring that your input file is in the same folder as your program executable. Although the class web page has a couple of test input subject files for you to use, we will test your program on test input files that are not provided to you. As part of this assignment, create input files that thoroughly test your program. Use vi, emacs, xemacs, wordpad, or notepad to create your input files. Do not use MSWord.
Turn in a Folder (Binder) containing:
Ask an instructor or TA if you have questions.
This document was generated using the LaTeX2HTML translator Version 2002-2-1 (1.71)
Copyright © 1993, 1994, 1995, 1996,
Nikos Drakos,
Computer Based Learning Unit, University of Leeds.
Copyright © 1997, 1998, 1999,
Ross Moore,
Mathematics Department, Macquarie University, Sydney.
The command line arguments were:
latex2html -split 1 as5S08
The translation was initiated by Sushil Louis on 2008-02-24