Skip to content

Instantly share code, notes, and snippets.

View waspyfaeleith's full-sized avatar

Sandy McMillan waspyfaeleith

View GitHub Profile

Lab - Rock Paper Scissors

Create a simple Android app to allow the user to play rock, paper, scissors.

They will enter their chosen move by clicking a button, the computer will randomly pick a move to play against them.

The player will see the both the computer's choice, and the result of the game on the screen.

You will need:

Fantasy Zoo Manager

Goal: Practice OO modelling in Java (unit tests, no UI)

You have been asked to create a zoo management app so that we can manage our bears, tigers, lions and other animals. The user must be able to add enclosures, add / remove animals, sell animals to other zoos. There should be at least two zoos, and at least three different animal species at each zoo, with different numbers of each species.

Additionally:

  • Animals can be fed so that they stay alive.
  • Animals cannot be placed in the same enclosure if they would eat one and other.

Homework

Tonight's homework is to think about how you would implement the game of 3 Card Brag (the rules of which can be found here: https://en.wikipedia.org/wiki/Three_card_brag ) in Java. Betting is NOT required.

At this stage we are only asking you to PLAN how you would do this i.e. think about which classes you think you would need, any interfaces you would use etc.

Think about the logic you would need to find the winning player and how to compare hands.

Remember to think about what tests you would need.

Lab

Today we looked at the Strategy pattern. There are many other patterns that developers have come up with that we can also use.

Choose one or more of the following patterns to investigate:

  • Factory
  • State
  • Command
  • Decorator

Lab / Homework

  • Add a new class Chicken which only clucks(), and allow the bear to eat it.
  • Add a method that returns the names of all the food in the bears belly (use class names)
  • Add a check so that if the bear is intolerant to the food when he eats it, he will throw up this item

Feel free to add other animals for practice. You may want to try adding your own interface(s).

Pizza Shop Lab

Objectives
  • Complete CRUD actions
  • Add more functionality to analysis model

So far we have created new objects of Pizzas and persisted them as rows in our DB.

We have also read from the DB with the .all method we created.

Installfest using Migration Assistant

Master copy

Ensure a machine is available to clone. This should be set up as per the instructions below.

Machine to be setup: Wipe drive and reinstall OS X

Skip this if it's a new machine

Press the power button. As soon as you hear the bing, press Cmd and R

Installfest Notes

Pre-install

  1. Identify which version of OSX you're using - ideally you should have El Capitan (10.11.x). If not, upgrade the OS in App Store.
  2. Install any OS updates displayed in the App Store
  3. Ensure that you've uninstalled any antivirus software you may have, as it can prevent some of the tools from installing properly

Test Score Block Graph

The Task

Given a set of 20 test scores (each score being out of 100), you are to determine the grade of each score (A,B,C,D, or E).

You then need find number of the scores of each grade as a percentage of the total number of scores e.g. if there are 5 test scores with a grade of B, then this would be 25%.

Finally, you are to display these percentages in the form of a block graph, where each 1% is represented by an asterisk e.g.:

@waspyfaeleith
waspyfaeleith / calc-u-l8r_in_c.md
Last active April 21, 2017 09:38
calc-u-l8r in C

Task - calc-u-l8r in c

Write a command line calculator application in C

Tasks:

  1. You already have the code to perform an addition, now add the following:

    functionality for 'subtraction'