Media Computation Skills Lab

MTEC 1003 - Spring 2015

Lab 8 - Prep - Creating Remote Repo and Cloning it, Warm Up Program(s)

Create Your Remote Repository

This will create a remote git repository on github.

  1. Go to your account home (github.com/username).
  2. Click on the Repositories tab.
  3. Click the green New button on the right side.
  4. Give your repository the name lab-08-if-while
  5. The repository should be public (the default).
  6. Click "Initialize this repository with a README".
  7. Click Create Repository.
  8. Refresh your main GitHub page and you should see the new repository.

Cloning your repository

This will clone the repository you just created on GitHub on your local machine.

cd ~
mkdir myname
ls -al
git clone https://github.com/your_username/lab-08-if-while.git

Cloning into 'lab-08-if-while'...
remote: Counting ojects: 3, done.
remote: Total 3 (delta 0), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), done.
Checking connectivity... done.
cd lab-08-if-while
git remote -v
origin https://github.com/your_username/lab-08-if-while.git (fetch)
origin https://github.com/your_username/lab-08-if-while.git (push)
# in the directory of your repository
git config user.name  "my first and last name"
git config user.email "my@email.address"
git config -l

Creating and Saving Changes Locally, Sending to Remote Repository

In this part of the lab, you will edit a text file in your local repository, and then you’ll send it to your remote repository.

git status
On branch master
Your branch is up-to-date with 'origin/master'.

nothing to commit, working directory clean
git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add ..." to update what will be committed)
  (use "git checkout -- ..." to discard changes in the working directory)

      modified:    README.md
no changes added to commit (use "git add" and/or "git commit -a")
git add --all
git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes to be committed:
  (use "git reset HEAD ..." to unstage)

      modified:    README.md
git commit -m "edited the README file"
[master 5b24d27] edited the readme file
 ...etc
git status
# On branch master
nothing to commit, working directory clean
git log --color
commit 5b24d2777a602908978916ca8fe9c8dd2ed6036b
Author: bree <bzuckerman@citytech.cuny.edu>
Date:   Wed Mar 5 11:45:21 2015 -0500

    edited the README file
git push origin master
Counting objects: 3, done.
Writing objects: 100% (3/3), 242 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/bzuckerman/lab-08-if-while.git
 * [new branch]      master -> master

Instructions for Warm-Up Programs

Note that ALL OF THESE FILES MUST BE SAVED IN THE LOCAL REPOSITORY THAT YOU CREATED FOR THIS LAB.


add dice

Write a program that asks for the result of two dice rolls. Add the results of both rolls and print out the sum.

(prompt) Give me a number for the first roll (1-6)
> 1
(prompt) Give me a number for the second roll (1-6)
> 5
The sum of both rolls is 6.

fortune

Write a program that asks for number. The program will translate that number into a fortune.

# Run 1
(prompt) Give me a number between 1 and 3, and I'll predict your future...
> 2
you will be hungry by the end of class

# Run 2
(prompt) Give me a number between 1 and 3, and I'll predict your future...
> 24
you don't follow directions very well

MTEC 1003 - Media Computation Skills Lab - Spring 2015