(E) Submission policy of the course

Warning

You can submit the exercise only after a repository has been created for you. Repositories will be created after the registration for the course has been expired, i.e. during the first study week.

Goal: I will learn how to submit a C++ program I have made into the automatic evaluation system used on the course, and to interpret the feedback of the automatic system.

On this course, we will use program templates that you will receive via the version control. The course personnel has saved them in your Git central repository, and you need to retrieve them into your local repository in order to study them. You will also use the version control to submit the programs you have created onto Plussa.

In this exercise, we will practise executing these steps. The programming part is small, just one line. The assignment text is long because it gives you very detailed instructions on using the version control.

Note that the point ”4) Saving the program in the version control” advices how to do saving in command line. However, saving can also be done in Qt Creator. Instructions for such saving can be found from the material at 14.2 Saving the program in the version control.

The structure of the data repository

The Git data repository of the course you have cloned has three directories:

  • templates, which contains the code templates
  • student, in which you will create your own programs
  • examples, which contains code for the example programs that are used in the course material.

Open the file control system of the remote desktop (Applications > Accessories > Files) and make sure you can find these directories.

Never edit the contents of the directories examples and templates. Never even delete any files from them. Changes in these directories will lead to trouble, as the personnel will add new materials and code templates on there as the course advances. If you modify these files, you will not be able to access the new files any more.

Stage 1) Retrieving the code template

When you start working on an assignment that has a code template made by the course personnel, it means that you will not create a project in Qt Creator, you just retrieve a ready-made project from the Git repository.

While reading the previous materials, you have just cloned the repository that currently includes all the changes made by the personnel.

If there is a ready-made code template, the assignment will always state the name of the directory in which the ready-made project template is located. The ready-made project templates are always stored as subdirectories of the directory templates. Copy the directory with the correct name as the subdirectory of the directory student. Be sure to copy and not move the directory, because it is not allowed to make any changes to the directory templates.

The template needed for this assignment can be found from the directory templates/01/first_submission. Now, open the version control system, and copy the aforementioned directory with the name student/01/first_submission. You should copy the whole directory templates/01/ at once into the directory student/01/, as all of the templates for round 1 will then be in the same place.

Stage 2) Opening a project in Qt Creator

In Qt Creator, choose the action ”Open File or Project…”, go to the directory student/01/first_submission and choose the project file (filename suffix .pro). Qt Creator will open a project that contains the code template. If the project first opens in the sheet “Configure Project,” just click “Configure Project.”

Please be sure to open the project from the directory student and not from the directory templates!

Stage 3) Completing the exercise

The program in the code template consists mainly of input and output commands, the meaning of which you can easily understand, even if you haven’t earlier seen a C++ program. If you need additional information about them, you can read material from the next round at 2.2.

The program asks the name and age of the user. Now add one output line to the program so that it works like this:

Enter your name: Will
Enter your age: 5
Pleased to meet you, Will!
In your next birthday you'll be 6 years old!

Stage 4) Saving the program in the version control (on command line)

This phase concerns saving the program in version control on command line (Terminal). If you wish to store your program in version control with Qt Creator, please read the Chapter 14 ”Option: Using Git from Qt Creator” at ”Saving the program in the version control”.

The very first thing is to configure your personal Git settings that can be found from the file ~/.gitconfig (~ means your home directory). Settings can be modified with any text editor (e.g. Applications -> Accessories -> Text Editor) or by using the command line commands:

git config --global <setting> <value>

If you have not set anything or if you are not sure whether you did or not, you can set them as follows:

git config --global user.name "Teemu Teekkari"
git config --global user.email "teemu.teekkari@tuni.fi"

These settings determine who is marked by Git as the creator of the version when a new version is added into the local repository.

After that we can start working with the actual submission. When you have created and tested your program, you need to save it into the version control in order to submit it for evaluation.

  1. First, check the situation of your files in version control. Move first to your local repository (named after your user id), and write on the command line the command git status. You should now see a list of the changes you have made to your working copy. Make sure that the new files you have created while doing this assignment are on the list ”Untracked files:”:

    # On branch master
    # Untracked files:
    #   (use "git add <file>..." to include in what will be committed)
    #
    #       student/01/
    nothing added to commit but untracked files present (use "git add" to track)
    

    In this case, the whole directory 01 is a new one, and thus, the files included in it will not be listed separately.

  2. Add the new files to the index with the command git add <path>, where <path> is a path to the new file or directory listed previously at ”Untracked files:”. In this case, the command is:

    git add student/01/
    

    In this way, you can add the whole directory student/01/, including all its files and subdirectories, to the index. You can use the command git add also to files. Alternatively, you could have added both the new files separately as:

    git add student/01/first_submission/first_submission.pro
    git add student/01/first_submission/main.cpp
    

    The command git add makes the new/modified files belong to the next commit (see below).

  3. Move the changes you have made into your local repository by writing the command git commit -m "Message", where Message describes the content of your commit as clearly and concisely as possible.

    If you only write git commit, a text editor will be opened, and you write your message there.

  4. Take the changes from the local data repository into the central repository by writing the command git push.

    Now you have added the changes of your working copy first into the index (add), and then to your local data repository (commit), and finally into your central data repository (push). You can also view the changes in your central data repository on your browser via the gitlab web address in case you want to see that the changes really were completed. You are also able to view the status of your project in the version control with the command git status.

Stage 5) Submitting the exercise

When your code is in the course’s Git repository, you can submit it onto the course platform with the form below. Copy the address of you Git repository (address ending .git) into the form and click the Submit button.

The next time you submit an assignment, you will be using the same repository, and your browser can remember the address given earlier. To launch the automatic evaluation system it is enough that the program code is located in your repository in a correctly named directory, and that you click the Submit button.

A+ presents the exercise submission form here.