Table of Contents
Example Labs
This is where you will keep your lab work for this course. If you need a refresher on git, see this high-level git guide.
Getting Started
Clone this repository to your computer.
git clone https://github.com/braden337/Labs.git
From the master
branch, make a new orphan branch for yourself (use your first
name with the number zero) and then delete README.md
.
git checkout --orphan firstname-0
git rm -f README.md
Commit your changes, and push this to remote.
git add .gitignore
git commit -m "Ignore Visual Studio files"
git push origin firstname-0
Now make another new branch from the one you just created, use your first name again and increment the number.
git checkout -b firstname-1
You don't need the master
or firstname-0
branch locally anymore, so you can
delete them.
git branch -d firstname-0
git branch -d master
Organization
Let's use Lab 1: FizzBuzz as an example. In Visual Studio, create a new .NET
Core console app named FizzBuzz
and save it at the root of this repository.
Your repository should now look like this.
.gitignore
FizzBuzz/
Submitting
Once you've made all your commits to complete the lab, push your firstname-1
branch to remote.
git push origin `firstname-1`
Then you can create a pull request on GitHub comparing your two consecutive branches.
- Lab 1 is
firstname-0
compared tofirstname-1
- Lab 2 is
firstname-1
compared tofirstname-2
- Lab 3 is
firstname-2
compared tofirstname-3
- ...
Make sure you give the pull request a title that makes sense (e.g. Firstname: Lab 1).
You can ask your peers to review the code in your pull request, give feedback (comments in the pull request), but there is no need to merge any of these.
Now that you've made your pull request, get things ready for the next lab. From
firstname-1
, check out a new branch.
git branch -b firstname-2
You can delete the previous branch because you're done with it now.
git branch -d firstname-1
I will close each pull request once I've looked at it and updated your grade in mylearning.
Lab 1: FizzBuzz
From 1 to 100:
- print Fizz for numbers that are divisible 3
- print Buzz for numbers that are divisible by 5
- print FizzBuzz for numbers that are divisible by 3 and 5
- otherwise print the number
Example for 7 to 15:
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
Lab 2: FizzBuzz (continued)
View my solution to Lab 1 in the Solutions/
folder.
Modify your FizzBuzz program from Lab 1 to count down from 100 instead of counting up to 100.
Lab 3: Fibonacci
Write a program that prints the first 15 Fibonacci numbers.
Example:
0
1
1
2
3
5
8