COSC-052: Computer Science II

Homework 1
Spring 2019

Due: W 1/23 @ 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. Compile and test the project on cs-class, ensuring it works with the Makefile from lecture. You might find the screencast on Makefiles helpful. There is also a screencast on how to use XCode to complete this assignment.
  3. Submit the project using Autolab. You can submit to the compile check five times. You can submit to the autograder two times.

Excruciating Detail

Get the code from lecture, Numbers and main, running on your chosen development platform.

For this and all other assignments, you can use any C++ compiler to develop your program, but your project must compile and run on cs-class using GNU g++ 5.3. To check the version, type

cs-class% g++ --version
g++ (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

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
For all of your submissions, you must include a file named HONOR that includes the following statement:
Name
NetID

In accordance with the class policies and Georgetown's Honor Code,
I certify that, with the exceptions of the course materials and those
items noted below, I have neither given nor received any assistance
on this project.

All of the files for your project should be in the directory hw1. For this assignment, the files you need are:

If you need to include a message about your submission, then place the message in a plain-text 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
Also make sure you remove all debugging output before submitting.

(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 (../) that includes 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
---------  ---------- -----   ----
      937  2018-01-03 11:21   Makefile
      150  2018-01-03 11:49   main.cpp
      115  2018-01-03 11:21   main.h
      265  2018-01-03 11:21   numbers.h
      365  2018-01-03 11:21   numbers.cpp
      221  2018-01-03 11:21   HONOR
---------                     -------
     2053                     6 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 cs-class, which preserves the modification date and time of your project. If the submission system breaks or you submit the wrong project, 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.

Once you receive a grade for a project, you can remove the zip file, the project directory, or both. 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 Canvas.

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