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***
1. Terminology. Define the following terms in
your own words and given an example of how each is used
·
Loop
invariant
·
Unit
testing
·
Implicit
type conversion
·
Debugger
·
Assertion
2. 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. Be thorough. Looking back,
did this process uncover mistakes made with the assignment?
3.
Style: Take a look at your program #2.
Examine how you used functions, arguments, and where your comments were. Did
you comment all variables? Was your algorithm clear so that someone could write
a program based on the algorithm with no other knowledge beside syntax. Discuss your findings as they relate to style.
4.
Ethics. The user of
computer technology reaches non-programmers on a daily basis with the use of
smart phones and the internet. Ethical violations can cause dramatic
repercussions throughout our culture if not handled. This is why thinking about
how we deal with ethical issues from a computer science perspective even more
important.
Come up with
an example of computer activity that is legal but not necessarily ethical in
regards to the privacy of information. For
Write
5 complete sentences with your thoughts.
Programming Assignment. The
purpose of the third program is to practice with structures, more practice with
writing functions with arguments and storing data in external data files.
Background:
Have you ever
wanted to go to Comic-Con? It is the international educational corporation
dedicated to creating awareness and appreciation for comics and the like. It all started in 1970 when a group of
comics, movie and science fiction fans got together to put on the first comic
book convention. Every year, in San Diego, CA, they put on a convention where
attendance can be of 130,000 people! Space is at a premium. And, it isn’t all
about comic books. There are programming events, games, anime, film, and so on.
It is so huge, just imagine the software needed to
assist with scheduling events, special guests (comic creators, sci fi and fantasy authors and so on) together to make it
work.
Your
Assignment: You will be
writing a program to schedule booths and events in a small annex of Comic-Con
that can hold up to 20 booths and 1 event per day (3 days). As vendors sign up
for booths your program will assign them one of the booth locations (1-20). The
information you will keep about each vendor will include (you can always add
more):
Events include featured guests. One per
day is scheduled for the annex that you will be managing. For guests you will
keep track of at least:
Your job for program #1 is to allow the
user to enter in the above information until all 20 booths (at most) have been
reserved and 3 events scheduled (at most).
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 this information 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 for
vendors and one for events? 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.
Once vendors and events are
stored, allow the usr to find out what booth location
a particular vendor is showing at and display the schedule of events. For
debugging purposes you should be able to display all vendors as well.
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). This should also
include your data files. 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
6. Remember to turn in an algorithm with your programming portion.
It is worth 20% of your program grade.
7. And,
don’t forget to add comments
and to work on your program’s readability; this is another 20%!!