Assignment #3
CS 162: Introduction to Computer Science
Submit your assignment to the D2L Dropbox
Email a backup copy to karlafgr@cs.pdx.edu
***Assignments in
CS162 consist of written homework and programming***
The written
portion MUST be turned in to get a grade on an assignment
LATE work
will be accepted – but ONLY within a week of the original due date.
We do not
accept late work beyond that
1.
Create
an Algorithm for the testing
software. When you think about writing code, just getting the program to
compile is just one part of the process. To really know if your program is
working, you need to test it in all different ways. Unit testing is a great
approach. Write an algorithm for testing
program #2 using the concept of unit testing each function. Be thorough. Looking back, did this process uncover
mistakes made with the assignment?
2.
Style: Take a look at your program #2.
Examine how you used functions, arguments, and where your comments were. Did
you comment all variables? Did each function have a header comment describing
the purpose of the function and of the arguments? Was your algorithm clear so
that someone could write a program based on the algorithm with no other
knowledge beside syntax knowledge. Discuss your
findings as they relate to style.
3.
Ethics:
There is a wide range of how computer ethics applies. One area has to do
with programs that do not function as we, the user, expect. This includes user
friendliness. When we use a program does the user really know what to do, and what not
to do. Again
take a look at your program #2 and discuss in one paragraph how this applies to
your program.
C++
PROGRAMMING PORTION
·
Remember to
write an algorithm for the program and pay close attention to “style”!
·
Also, do your
work for your programming part on either of these systems:
1. linuxlab.cs.pdx.edu or linux.cecs.pdx.edu (linux)
2. cs.pdx.edu (unix)
4.
Programming. The purpose of the third program is to
continue refining our use of functions and arguments in C++ and practice using arrays of characters, structures, and
external data files. Again, our goal is to create programs with a small functions where main delegates to a series of
functions where the real work takes place. In this programming assignment, you
are not allowed to use global
variables. Limit your functions to no more than 30 statements of code (for
executable statements… not counting
variable definitions, blank lines, lines with just curly brackets, or comments).
Program Assignment:
How do you plan what college classes you
are taking? Do you develop a 4-year plan? Do you modify that plan as you take
classes and as you find certainly classes may only be offered some of the time?
Your job for program #3 is to allow the
user to enter in a plan for classes being taken. It should include classes that
you have taken, classes you are currently taking, and plans of classes to take
in the future. Information for each class should include at least:
1. Department and Class number (e.g., CS
162)
2. Class name (e.g., Introduction to
Computer Science)
3. Term and year you have/are taking the
class (Winter 2014)
4. Comments (e.g., This class is not offered
in the Summer)
5. Required (e.g., is this required or not
for your degree)
6. Optional other information – grade for
past classes
You should support up to a maximum of 60 classes
in memory. Hint: You will need to use
arrays of structures for this!
A large piece of this
assignment is to use external data files, so that all class you have taken and
plan to take is stored and won’t be lost next time the program is run. Be creative with the files used, but plan
ahead so that there is consistency in your design. Consider having more than a
single file – one per year? Or one for past classes versus
one for future? Your choice!
Remember with external data
files, the information that you store in the files must be written in such a
way that it is easy to read it back in. Also, make sure to keep all files in
your “current working directory” on unix
as the grader will not be able to replicate your directory structure.
IMPORTANT:
Your program
should allow classes to be added to the list (up to 60), saved them in external
storage, load in classes previously stored, and allow the user to display all of
the classes or display just the classes for a particular term. Let the user
continue to do this using a loop until they want to quit.
***You are always welcome to do more! Such
as you may use classes, but they are not required. Really focus on making
general purpose functions that can be re-used.
Things
you should know...as part of your program:
1.
Make
sure to prompt the user for any input requested. Make sure it is clear from
your prompts what the user is expected to do.
2.
Use
the subscript operator [] to work with individual elements of your array of
structures
3.
You may not use any global variables in
this program!
4.
You may not use the string class –
instead use arrays of characters. You are
allowed to use the cstring library.
5.
Make
sure to use C++’s I/O (iostream library) for your
input and output.
6.
After
each input operation, make sure to use cin.ignore to
remove the delimiters!
7.
With
external data files, first read before checking for end of file:
i.
Read
ii.
While
(!infile.eof())
1.
Process
what was read
2.
Read
again
To
get full credit for the programming portion, you will need to:
1.
Turn in an algorithm written using full English
sentences (it may be provided in outline form, paragraph form, or graphical
(such as a data flow diagram)). It can be supplied as part of your header
comments or as a separate file.
2.
Program using a consistent style of indentation,
header comments for each function, inline comments for each major block of code
3.
Make sure to put your name in your program
4.
Submit an electronic copy of your .cpp file as
an attached file to the dropbox on D2L (go to:
http://d2l.pdx.edu/ to login). Make sure to
hit the submit button after uploading your files (otherwise they will be lost)
5.
As a backup, please also email your work (as
attached file(s)) to karlafgr@cs.pdx.edu