Homework Assignment #2
CS 161: Introduction to Computer Science 1
Submit your assignment to the D2L Dropbox (sign on via www.my.pdx.edu)
or Email your answers to: karlafgr@cs.pdx.edu
***Homework in CS161 consists of written homework
and programming***
1.
Create an Algorithm for turning in assignments using D2L’s
dropbox. Write the algorithm in an
outline form using complete sentences. Think of (a) how do you login, (b) how
do get to the dropbox, (c) how do logout, etc.
·
Assume
you are writing the algorithm for someone who has never used D2L before
·
Be
careful not to skip any steps
·
Desk
check your algorithm (go through the
algorithm as if you were turning in an assignment!)
2.
Think about Style (i.e.,
how readable and/or maintainable a program is). Examine the program that was submitted for
Homework #1. Think about what could be improved to make it more readable. Find 3 things that could be improved and
write about them using complete sentences.
·
Now,
Rewrite the program improving upon the style – using your suggestions. Go
overboard!
·
Hint:
you are looking for things that make the programs particularly easy to read.
3. Ethics.
We have learned in lecture
that ethics can involve messages that are displayed to the user that can have
devastating results. Give
an example of an unclear message you have encountered in the past. Explain what
the message said and what it meant to you. Can you think of a better message
that would have been clearer to you?
4.
Programming. You have two choices for creating a program
in homework #2. Only select one of the choices.
·
Graphics: (If you are using Dev C++ and graphics.h
then you can select this project)
Write a C++ program that
draws widget, such as what we use in D2L. The program must use (a) lines, (b)
circles or ellipses, and (c) text. For example, is one of the widgets in D2L. You can keep it simple. Try to have fun
with it!
·
Or,
on Unix or for Mac users: (If
you are using Unix or Linux then you can select this project)
Write a C++ program that
calculates tips. This is like an application you might have on your phone or
ipad where you enter in the cost, the percentage tip you would like to leave,
and then the program will display the amount of money to leave as a tip. (Hint:
This will be very similar to the inches to mm program in the slides, except
that the math and inputs are different).
We will talk in class this week how to
get the output formatted nicely when working with money. You will do this with
cout statements. Try to have fun with this!!