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.

A suggestion. In homework 1 you set up a system for being able to use VSC on you local machine to work with files on the lab machines. Use that system. In particular, create a new directory within the 245 directory you created in homework 1, presumably called something like "HW2".

Through this assignment you will be building a series of programs that hold, information about rocket launches. A description of the columns in this data 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
vehicle string the type of rocket
flight String A descriptor of the flight. Usually unintelligible.
launch site string The location of the rocket launch
launchpad string the place within the location
apogee integer max distance from earth
category string I am sure that this is meaningful, just not to me.

Throughout this assignment, all printing should be done using fmt.Printf rather than fmt.Println (or println). For the String() method (below) you must 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 rather than 3 independent variables. Create several more data items so you have a total of at least 7 stored in your slice. Here is some more data.
1968,01,16 , Voskhod 11A57 , Ya15002- 05    , NIIP-53    , 5         ,    441 , Sat
1958,05,22 , Nike Cajun    , -              , WI         , 1         ,    240 , Balloon
1983,01,14 , Kappa 9M      , K-9M-76        , KASC       , c         ,    349 , Aeron/Io
1966,08,25 , R-16U         , G 22603-13T    , NIIP-5     , o         ,   1210 , OT
2003,08,08 , Zenit-3SL     , SL10/DM-SL-10L , KLA        , c         ,  36090 , Sat
2012,09,12 , Terrier Lynx  , -              , WI         , c         ,    300 , Target
1978,12,19 , Proton-K/DM   , 295-02         , NIIP-5     , 2         ,  51018 , Sat
2018,10,11 , Sineva        , VMF RF         , BLA        , f         ,   1000 , OT

        
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.

Make a README

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, everything you write in the README.

The easiest place to write your readme is within VSC. Make a file just like a code file but name it README.txt (or just README) then just write in it. You should start by copying the sample readme. Put the README file into the HW2 directory.

Submit

These directions assume that you followed the suggestions above and have a directory named HW2 inside a 245 directory on the UNIX servers.

  1. Open a terminal window on your computer (a windows powershell or a Mac terminal)
  2. if it is still on your local machine, copy the PDF file of your report into the HW2 directory on the UNIX servers. To do so:
    1. first put the PDF (or test file) into the place where you are in the terminal (or switch the terminal to the place where the PDF file is).
    2. Second copy the file over to UNIX. I assume the pdf file is names "report2.pdf". To do this (assuming things from homework 1)
          scp report2.pdf lab186:245/HW2
      
    3. Use similar scp commands to get any other files from your local machine to the UNIX machines
  3. When all of the files are in the HW2 directory and you are still in the 245 directory
        /home/gtowell/bin/submit  -c 245 -p 2 -d HW2
            
    This says to submit for project 2 (-p) everything in the directory HW2 (-d) for the class 245 (-c). You should see listing of all the files you submitted and a message that says "success".
  4. 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 gtowell@brynmawr.edu with all of your files attached. I will accept this for assignment 2 ONLY. You should also find me so that we can work out what went wrong and so that it does not go wrong next time.

The submission should include the following items:

README:
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)
DO NOT INCLUDE:
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 HW2 directory within /home/YOU/245/

  1. Go to the directory /home/YOU/245
  2. Enter /home/gtowell/bin/submit -c 245 -p 2 -d HW2
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.