In this homework you will write a series of programs using Go. The second will build on the first, etc. But submit each part as if they were completely independent. Each part should be in a single .go file that is runnable independent of any other .go file.

Through this assignment you will be building a series of programs that hold, and read, information about aircraft takeoffs and landings. The information to hold is given in the following table.
id type description
year integer the year
month integer month 1==January, etc
day integer day of month. First day of month is 1
deptime integer departure time in 24 clock without a colon. So 715 is 7:15am and 2355 is 11:55pm
arrtime integer as with departure time
carrier string a short string giving the airline ID.
flightnum integer the flight number
arrdelay arrival delay in minutes. Negative number indicates early arrival.
depdelay integer in minutes
origin string ID of the originating airport. If not PHL, then an arrival
destination string ID of the destination airport. If not PHL, then a departure.
distance integer the length of the flight, in miles
cancelled boolean true if the flight was cancelled

Throughout this assignment, all printing should be done using fmt.Printf rather than fmt.Println. For the String() method (below) use fmt.Sprintf.

Part 1 -- Structs: 33%

Write a program that does the following:

Part 2 -- Slices: 33%

Take the program from part 1 and adapt it so that the data is stored in a slice structure rather than 3 independent variables. Create several more data items so you have a total of at least 10. Here is some more data.
With the slice, do the following

Part 3 -- Questions: 33%

Provide answers to the following questions (also provide an answer to the question posed in part 1). You answers may be in your readme file, another text file, or a PDF. If not in the readme, be sure to say in the readme what file contains the answers to the questions.
  1. From part 1: Explain your answer to "Are the original and the copy equal?" As a part of your explanation discuss how a copy of a struct differs from a similarly made copy of an object in Java?
  2. From part 2: Consider the original slice and the slice with the first 5 items. Are the items in position 1 of the two slices equal (the answer should be yes)? If you change the value of a field in the struct in position 1 of the original slice, is it still equal to the item in position 1 of the second slice? Explain why the answer to this question makes sense with respect to your answer to the first question.


Electronic Submissions

Your submission will be handed in using the submit script.

If you write your program on computers other than those in the lab, be aware that your program will be graded based on how it runs on the department’s Linux server, not how it runs on your computer. The most likely problem is not submitting everything or hard coding file locations that are not correct on the Linux servers.


Once you have finished coding (and fully commenting your code) make a README file. This file should follow the format of this sample README. This is your opportunity to tell me what went well or poorly, what is still broken and why, etc. I will read, and often respond to, everthing you write in the README.

The easiest place to write your readme is within VSC. Make a file just like a standard java file but name it README.txt then just write in it. You should start by copying the sample readme.


If you developed this program on your own computer, you should be able to use the systems set up in lab to help get files to Linux. If you did not get SFTP set up within VSC then do the following:

  1. Open a terminal window on your computer (a windows powershell or a Mac terminal)
  2. Connect to a linux lab machine. A full list of possibly available lab machines is at Machine list. I will assume you are using -- you can use any machine. To connect:
                                ssh YOURNAME@
                                ssh lab186
    Enter your Unix password if/when prompted
  3. On the linux computer:
                                 cd cs245
                                 mkdir a1
    You can change a1 to whatever you like, the directions below assume a1.
  4. Leave this terminal window open and connected to Linux, you will use it again in a couple of steps
  5. Within VSC open a terminal by going to the Terminal menu and selecting "new terminal"
  6. In the Terminal inside of VSC you should be in the directory containing your program. Enter
                                 scp * YOURNAME@
  7. You should get messages on screen showing that each file in this directory has been copied. Make sure you get all of the files you want to submit.
  8. Confirm that the copy was successful. Back in the Terminal you opened on the Linux machines (in the first steps)
                                 ls a1
    This should show a list of of the files copied in your scp command.
  9. When all of the files are in the a1 directory and you are still in the cs245 directory
                                 /home/gtowell/bin/submit  -c 245 -p 1 -d a1
    This says to submit for project 1 (-p) everything in the directory a1 (-d) for the class 245 (-c). You should see listing of all the files you submitted and a message that says "success".
  10. You can submit multiple times. I will grade only the last submission -- unless you tell me otherwise. The submission process attaches a timestamp so I know when you submitted (down to the second). The closest submission I have ever received to the deadline is 7 seconds.

If the submission deadline is approaching and you cannot get this process to work, send email with all of your files attached. I will accept this for assignment 1 ONLY.

The submission should include the following items:

This file should follow the format of this sample README
Source files
All of them
Question answers
If separate from readme.
Data files used:
Be sure to include any non-standard data files uses. (Rare)
Data files that are read from the class site. Do include any of your own data files.

Again: Once you have everything you want to submit in the a1 directory within /home/YOU/cs245/

  1. Go to the directory /home/YOU/cs245
  2. Enter /home/gtowell/bin/submit -c 245 -p 1 -d a1
If this worked you will get a message with the word "success". If you cannot achieve success and the deadline is approaching, send me email. We can set up a meeting to work out your problems. The email will establish that you intended to submit. Once you send the email, do not change the files that you were trying to submit.