Homework 1
Spring 2020
Due: W 1/22 @ 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
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.1. To check the version, type
cs-class% g++ -v Using built-in specs. ... gcc version 5.3.1 20160406 (Red Hat 5.3.1-6) (GCC)
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/enableThis 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 $SHELLYou 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 ./.bashrcTo 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 hw1If 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 hw1For 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 *.oAlso 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 filesIt 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 hw1 assignment, and submit your file submit.zip. You have two chances to submit properly.
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.zipTo remove the directory, type:
cs-class% rm -r hw1You will follow this same process for each assignment.
Copyright © 2020 Mark Maloof. All Rights Reserved. This material may not be published, broadcast, rewritten, or redistributed.