Homework 1 for Computer Science 125
Introduction to Computer Science
Boise State University, Spring 1999
This homework is due by 9pm, Tuesday,
26 January 1999. See the directions below
to electronically submit homework.
Warm-up and Practice Problems
These are not be turned in. They are to help you understand
the material, and some will appear on exams.
- CCJ: Exercise R1.13, p 36.
- CCJ: Exercise R1.15, p 36.
- CCJ: Exercise R1.16, p 36.
- CCJ: Exercise R1.18, p 36.
- Ethics: Give an example of an ethical dilemma
discussed in Chapter 1. Who is involved in
the dilemma? Which part of the ACM code
(see Appendix A) covers this dilemma?
Submitting Programs
Programming exercises are submitted electronically. Before
you start an exercise, you should do the following:
- Create a directory (or folder) for your homework.
For example, for program 1, type at the prompt:
mkdir p1
(This command creates a new directory called ``p1''.)
- Use this directory when creating any files for the
exercise. Again, for program 1, the easiest way to
do this is to type:
cd p1
(This ``changes directories'' to p1.)
To create the file for your program, you type:
gvim Hello.java
(or ``emacs'' if you prefer that to ``vi''.)
- To return to your home or main directory, type:
cd
You will want to do this after finishing one program
but before starting the next one.
After you have finished a program and tested it thoroughly,
you need to submit the program electronically. To submit
a program, you do the following:
- Include the honesty pledge at the top of each program:
/* I, < insert you name here>, pledge that this program is
my own indepedent work and conforms to the academic
honor code.
*/
- Include a comment with your name, your login, and a
short description of what your program does.
- Change directories to the program you would like
to submit. To check to see that you're in the
right place, use the commmand
pwd
The directory path returned should end in ``p1'' for
Program 1.
- Compile your program. For example, to compile Hello.java,
you type:
javac Hello.java
If there are errors, you will need to edit your program,
fix them, and compile again.
- To run your program, type:
java Hello
(The program should say ``Hello World!'' with the exact
spacing given below.)
- Type the submit command
submit stjohn cs125 1
Since this command gets used for many different courses,
you need to specify the instructor and course name before
specifying which program number you are submitting.
(``stjohn'' is the instructor of the course, ``cs125'' is
the course name, and ``1'' stands for Program 1).
If all goes well, the submit command will say the program
has been successfully submitted. If it doesn't, something
went wrong. You should get help and submit the program
again.
Graded Problems
P1. Program the "Hello World" program described on
p 21 of CCJ. Submit this as program 1,
using the electronic submission described above.
P2. CCJ: Exercise P1.5, p 38. Submit this as program 2,
using the electronic submission described above.