COSC-052: Computer Science II

Homework 1
Spring 2013

Due: Thursday, Jan 24 @ 5 PM
2 points

This homework is to get you familiar with program organization, Makefiles, and how you'll be submitting projects this semester. You are to

  1. Get the code from class (avgnums) running on your chosen development platform. Your submission must include a working basic Makefile.
  2. Submit the project from cs-class using the submit command.

Get the avgnums program running on your chosen development platform. At the top of the file main.cc (or the file containing the main function), place the following header comment, with the appropriate substitutions:

//
// COSC-052 Homework 1
// Name: <your name>
// ID: <GoCard ID>
// E-mail: <e-mail address>
// Instructor: Maloof
//
// In accordance with the class policies and Georgetown's Honor Code,
// I certify that, with the exceptions of the class resources and those
// items noted below, I have neither given nor received any assistance
// on this project.
//

Although you may use any C++ compiler to develop your program, it must run on cs-class, under Unix, and must compile using GNU g++. You must also provide a working basic Unix Makefile for your project.

If you haven't already, set up your shell account. To determine what shell you're using type:

cs-class% echo $SHELL
You should see either "/bin/tcsh" or "/bin/bash".

If you want to change your shell to tcsh, type

cs-class% chsh -s /bin/tcsh
Unix should tell you that it changed your shell.

To configure tcsh, from your top-level directory, copy the following file from my account:

cs-class% cp ~maloofm/mm.cshrc ./.cshrc
Then, to apply the settings in the file, type
cs-class% source .cshrc

If you want to change your shell to bash, type

cs-class% chsh -s /bin/bash
Unix should tell you that it changed your shell.

To configure bash, from your top-level directory, copy the following file from my account:

cs-class% cp ~maloofm/mm.bashrc ./.bashrc
Then, to apply the settings in the file, type
cs-class% source .bashrc

From now on, the settings in this file will be applied whenever you log in.

You'll be using the submit program to submit your assignments. To get the submit program, on cs-class, type

cs-class% cp ~maloofm/cosc052/submit.jar ./

Copies of the submit program from previous semesters will not work, so get a fresh copy.

If you haven't already, place all of your code in a subdirectory named hw1. To create this subdirectory, type

cs-class% mkdir hw1
Ideally, you'll create this directory before starting your project, if you are developing on cs-class. If you are not developing on cs-class, use secure ftp to transfer your files from your computer into this directory.

To descend into the directory, type

cs-class% cd hw1
All of the files for your project should be in this directory. The submit program should be in the parent directory above this directory:
cs-class% ls ..
hw1/ submit.jar

If you need to include a message about your submission, then place the message in a file named README. Place the README file in the project's directory.

Before submitting, to reduce the size of the zip file, remove the executable and .o files by typing 'make clean':

cs-class% make clean
rm -f a.out *.o

To move from the hw1 directory to the parent directory, type

cs-class% cd ..
At this point, you should be above the hw1 directory:
cs-class% ls
hw1/ submit.jar

(Additional useful Unix commands)

When you're ready to submit, change the name of the directory to your netid. For example, if your netid is maloofm, then rename (or move) the directory hw1 by typing

cs-class% mv hw1 maloofm
Create a zip file of the directory and its contents by typing
cs-class% zip -r hw1.zip maloofm/*
This command creates a zip file named hw1.zip by recursively (-r) copying all of the files (*) from the directory maloofm/.

To submit the zip file type

cs-class% java -jar submit.jar -a hw1 -f hw1.zip
hw1 is the name of the assignment (-a) and hw1.zip is the file (-f) to be submitted for that assignment.

If the program submits the file successfully, you will receive a receipt by e-mail at the address <netid>@georgetown.edu.

Submit your project only once.

Once you've submitted your project, it is important to keep an electronic copy on a university machine (e.g., cs-class) that preserves the modification date and time. If we lose your project or the submission system breaks, then we will need to look at the modification date and time of your project to ensure that you submitted it before it was due.

You can also change the directory's name back to the original name. For example,

cs-class% mv maloofm hw1
Note that changing the name of the directory does not change the dates of the files in the directory. You can also remove the zip file from your directory:
cs-class% rm hw1.zip

You must submit your project before 5 PM on the due date.

Copyright © 2019 Mark Maloof. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed.