COSC-052: Computer Science II

Homework 1
Spring 2017

Due: F 1/20 @ 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 lecture, Numbers and main, running on your chosen development platform. You might find the screencast on program organization helpful.
  2. Test the project on cs-class, ensuring it works with the Makefile from lecture. You might find the screencast on Makefiles helpful.
  3. Submit the project using Autolab. You get two attempts.

Excruciating Detail

Get the code from lecture, Numbers and main, 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:
 * NetID:
 * Instructor:
 *
 * 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.
 */

For this and all other assignments, you can use any C++ compiler to develop your program, but it must run on cs-class and must compile with GNU g++ 5.2. Your project must have a file main.h with all of the necessary include directives. Keep in mind that file names on Linux machines are case sensitive, and on Macs they probably are not, even though it's a Unix machine. For example, on a Mac, if you have a file named "Numbers.h" and include "numbers.h", it will compile on a Mac, but it won't compile on cs-class or on autolab.

For this and all other assignments, you must provide a working Makefile for your project. The Makefile must produce an executable with the default name a.out. There must be a clean target that removes all of the .o files.

If you've used your account on cs-class for previous classes, make sure you have the following command in your .bashrc file:

source /opt/rh/devtoolset-4/enable
This ensures you have enabled Red Hat's development tools and the correct version of the C++ compiler.

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 "/bin/bash".

To configure bash, the Bourne Again Shell, from your top-level directory, copy the following file from the top-level directory maloofm:

cs-class% cp ~maloofm/mm.bashrc ./.bashrc
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.

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

cs-class% cd
cs-class% mkdir hw1
If you are developing on cs-class, you'll create this directory before starting your project. 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. For this assignment, the files you need are:

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. You can also use .cpp as the file extension.

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

(Additional useful Unix commands)

When you're ready to submit your project for autograding, create a zip file of directory's contents by typing

cs-class% zip ../submit.zip *
This command creates a zip file named submit.zip in the parent directory (../) and including all of the files (*) in the current directory.

To see the contents of the zip file, type:

cs-class% cd ..
cs-class% unzip -l submit.zip
Archive:  submit.zip
  Length      Date    Time    Name
---------  ---------- -----   ----
     851  2016-12-17 11:18   Makefile
     150  2016-12-17 14:53   main.cc
     115  2016-09-26 14:30   main.h
     265  2016-09-26 11:04   numbers.h
     312  2016-09-26 11:04   numbers.cc
---------                     -------
    1693                     5 files
It is imperative that the zip file contains only the files of your project with no subdirectories.

Use a secure file-transfer program (sftp or FileZilla) to transfer the zip file from cs-class to your laptop. (You can also produce the zip file on your laptop.)

To submit the zip file, use your browser to log on to Georgetown's instance of Autolab. Navigate to the correct course and assignment, and submit your file.

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. Retain either the zip file or the directory containing your project's files.

To remove the zip file, type:

cs-class% rm submit.zip
To remove the directory, type:
cs-class% rm -r hw1
You will follow this same process for each assignment.

Plan B

If Autolab is down, upload your zip file to Blackboard.

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